Fancybox Slideshow works only once

六月ゝ 毕业季﹏ 提交于 2019-12-22 11:15:35

问题


My Fancybox slideshow only works once and stops. From what I can tell is that it's not looping back because something broke which I can't figure out what. If you go to their page to "Extended functionality" and try it out you'll see that it's not working there either.. or at least for me.

<!-- Add Fancybox library -->
<script type="text/javascript" src="http://www.Website.com/+Fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="/+Fancybox/jquery.fancybox.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.Website.com/+Fancybox/jquery.fancybox.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://www.Website.com/+Fancybox/helpers/jquery.fancybox-buttons.css" />
<script type="text/javascript" src="http://www.Website.com/+Fancybox/helpers/jquery.fancybox-buttons.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.Website.com/+Fancybox/helpers/jquery.fancybox-thumbs.css" />
<script type="text/javascript" src="http://www.Website.com/+Fancybox/helpers/jquery.fancybox-thumbs.js"></script>
<script type="text/javascript" src="http://www.Website.com/+Fancybox/helpers/jquery.fancybox-media.js"></script>

<!-- Fancybox Properties -->
<script>
$(document).ready(function() {

    $.noConflict();

        $('.fancybox').fancybox({
        padding     :  0,
        prevEffect  : 'fade',
        nextEffect  : 'fade',
        openEffect  : 'elastic',
        closeEffect : 'elastic',
        autoPlay    : 'true',
        mouseWheel  : 'true',
        helpers     : {
            buttons : {},
            title   : {
                    type: 'outside'
            }
        }
    });
});
</script>

Responsive Fancybox: http://www.fancyapps.com/fancybox/

Google Chrome: v24.0.1312.57


回答1:


I can confirm that there is a bug if using jQuery 1.9.x

Fancybox v2.1.3 was broken using jQuery 1.9.x as you can see it here. Then v2.1.4 was released to make it work with jQuery v1.9.x but it seems to me that the buttons helpers js file has to be patched as well.

As a workaround, you can rollback to jQuery v1.8.3.

See a working JSFIDDLE using jQuery 1.8.3.

See a broken JSFIDDLE using jQuery 1.9.1.

PS. I did open an issue at github

** UPDATE :

The issue was fixed in the last commit (not updated in fancyapps home page samples neither the downloadable file though)




回答2:


I don't know if this causes your problem, but if you set jQuery.noConflict(); you have to use jQuery instead of $ like this: jQuery('.fancybox').fancybox({...



来源:https://stackoverflow.com/questions/15007825/fancybox-slideshow-works-only-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!