0

http://bvh.delineamultimedia.com/?page_id=2 -> 如果您单击第一张图片,下拉菜单中有一个画廊……这就是我想要的。但是,如果您关闭它并重新打开它。它转到静态图像。

所以我正在使用的这个js中有一个函数语句,似乎无法弄清楚问题是什么。http://bvh.delineamultimedia.com/wp-content/themes/bvh/js/portfolio/superbox.js

这里是函数...

$('.superbox').on('click', '.superbox-list', function (e) {

//allows for superbox to work inside of quicksand
$('ul.filterable-grid').css({
    overflow: 'visible'
});

var currentimg = $(this).find('.superbox-img');

// cleanup
superbox.find('.title').remove();
superbox.find('.description').remove();
superbox.find('.royalSlider').appendTo(superboximg);
//superbox.find('.royalSlider').appendTo($(this)); // remove the slider from previous events
//superbox.find('.royalSlider').remove();

var imgData = currentimg.data();
superboximg.attr('src', imgData.img);
if (imgData.title) {
    superbox.append('<h3 class="title">' + imgData.title + '</h3>');
}
if (imgData.description) {
    superbox.append('<div class="description">' + imgData.description + '</div>');
}





//royal slider fix

var sliderData = currentimg.siblings('.royalSlider'); // grab the slider html that we want to insert

if (sliderData.length > 0) { // show the slider if there is one
    superbox.append(sliderData); // clone the element so we don't loose it for the next time the user clicks
    superboximg.css('display', 'none');
} else { // if there is no slider proceed as before
    if (imgData.img) {
        superboximg.attr('src', imgData.img);
        superboximg.css('display', 'block');
    }
}







if ($('.superbox-current-img').css('opacity') == 0) {
    $('.superbox-current-img').animate({
        opacity: 1
    });
}


if ($(this).next().hasClass('superbox-show')) {
    superbox.toggle();
} else {
    superbox.insertAfter(this).css('display', 'block');
}

$('html, body').animate({
    scrollTop: superbox.position().top - currentimg.width()
}, 'medium');

});
4

1 回答 1

0

如果您重新打开页面,浏览器将再次从头开始加载 url ( http://bvh.delineamultimedia.com/?page_id=2 )。如果您想重新显示某些内容,则必须更改 url 并确保 JavaScript 能够选择它。这通常使用window.location.hash.

于 2013-04-01T18:57:34.920 回答