Conflict between Fancybox and other JQuery

对着背影说爱祢 提交于 2019-12-13 04:06:07

问题


i'm using 3 different JQuery plugins to build a website.

  • http://web-kreation.com/demos/Sliding_login_panel_jquery/
  • http://www.thewebsqueeze.com/web-design-tutorials/create-a-horizontal-scrolling-website.html
  • LINK3:http://fancyapps.com/fancybox/

But, there's a small problem. The first 2 plugins work happily together, but when I insert Fancybox, one of the plugins (mostly Fancybox, but sometimes Sliding Login) will be disabled and behaves himself as it would do without JQuery.

<!-- PNG FIX for IE6 -->
<!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 -->
<!--[if lte IE 6]>
    <script type="text/javascript" src="js/pngfix/supersleight-min.js"></script>
<![endif]--> 
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script src="js/jquery.localscroll-min.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.fancybox.js?v=2.0.6"></script>
<script type="text/javascript" src="js/jquery.mousewheel-3.0.6.pack.js"></script>

<script type="text/javascript">
$(document).ready(function () {

    $.localScroll.defaults.axis = 'x';
    $.localScroll();

    // Expand Panel
    $("#open").click(function(){
        $("div#panel").slideDown("slow");

    }); 

    // Collapse Panel
    $("#close").click(function(){
        $("div#panel").slideUp("slow"); 
    });     

    // Switch buttons from "Log In | Register" to "Close Panel" on click
    $("#toggle a").click(function () {
        $("#toggle a").toggle();
    });

    $("a.fancybox").fancybox();
});
</script>

And here's the link:

<a class="fancybox" href="http://www.google.nl?id=<? echo $selectusers2['UID'] ?>" title="<? echo $selectusers2['test']." ".$selectusers2['test']." ".$selectusers2['test']; ?>"><? echo abbreviation($selectusers2['test']." ".$selectusers2['test']." ".$selectusers2['test'],17,'...'); ?></a><br />

I hope someone will know why those are conflicting and likes to solve it :)


回答1:


Fancybox v2.x requires jQuery v1.6 or later. Upgrade your version of jQuery

You could call the latest version of jQuery with this

<script src="http://code.jquery.com/jquery-latest.js"></script>


来源:https://stackoverflow.com/questions/10356879/conflict-between-fancybox-and-other-jquery

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