jQuery使用多个库。存在冲突错误。

时间:2014-02-04 10:14:29

标签: jquery

轮播的第一个脚本

<script>
  jQuery.noConflict(); 
  /* calling thumbnailScroller function with options as parameters */
  (function($){
  window.onload=function(){ 
      $("#tS3").thumbnailScroller({ 
        scrollerType:"clickButtons", 
        scrollerOrientation:"vertical", 
        scrollSpeed:2, 
        scrollEasing:"easeOutCirc", 
        scrollEasingAmount:800, 
        acceleration:4, 
        scrollSpeed:800, 
        noScrollCenterSpace:10, 
        autoScrolling:0, 
        autoScrollingSpeed:2000, 
        autoScrollingEasing:"easeInOutQuad", 
        autoScrollingDelay:500 
      });
  }
  })(jQuery);
</script>

在线弹出的第二个脚本:

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

如何将两者结合出冲突错误,我很简单,但我是jQuery的新手。

1 个答案:

答案 0 :(得分:0)

如果要将它们组合起来,只需将它们组合起来即可。根据您提供的有限信息,它看起来像这样。

<script type="text/javascript">
  jQuery.noConflict();
  (function($) {
      $("#tS3").thumbnailScroller({
        scrollerType:"clickButtons",
        scrollerOrientation:"vertical",
        scrollSpeed:2,
        scrollEasing:"easeOutCirc",
        scrollEasingAmount:800,
        acceleration:4,
        scrollSpeed:800,
        noScrollCenterSpace:10,
        autoScrolling:0,
        autoScrollingSpeed:2000,
        autoScrollingEasing:"easeInOutQuad",
        autoScrollingDelay:500
      });
      $('.fancybox').fancybox();
  })(jQuery);
</script>