繁体   English   中英

If / Else语句在Click上显示不同。

[英]If/Else Statement showing differently on Click.

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');

});

如果重新打开页面,浏览器将再次从头开始加载URL( http://bvh.delineamultimedia.com/?page_id=2 )。 如果要重新显示某些内容,则必须更改URL并确保JavaScript能够接收它。 这通常是通过window.location.hash完成的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM