2014-01-17 59 views
1

我相信這兩個Jquery之間存在衝突。我的jquery版本是:1.8.2。兩個代碼之間的jquery衝突讓我瘋狂

<script type="text/javascript"> 

jQuery(document).ready(function($) { 


    var portfolioCarousel = $("#widget-portfolio-2"); 

    portfolioCarousel.carouFredSel({ 
     width : "100%", 
     height : "auto", 
     circular : false, 
     responsive : true, 
     infinite : false, 
     auto : false, 
     items : { 
      width : 280, 
      visible: { 
       max: 1 
      } 
     }, 
     scroll : { 
      wipe : true 
     }, 
     prev : {  
      button : "#widget-portfolio-2-prev", 
      key : "left" 
     }, 
     next : { 
      button : "#widget-portfolio-2-next", 
      key : "right" 
     }, 
     onCreate : function() { 
      $(window).on('resize', function(){ 
       portfolioCarousel.parent().add(portfolioCarousel).css('height', portfolioCarousel.children().first().outerHeight() + 'px'); 
      }).trigger('resize'); 
     } 
    }); 

}); 

這一個:

<script type="text/javascript"> 

      jQuery(document).ready(function() { 
       jQuery('#example2').showbizpro({ 
        dragAndScroll:"off", 
        visibleElementsArray:[5,4,3,1], 
        carousel:"on", 
        heightOffsetBottom:10, 
        mediaMaxHeight:[150,150,150,150], 
        rewindFromEnd:"off", 
        autoPlay:"off", 
        delay:2000, 
        speed:750 
       }); 



       // THE FANCYBOX PLUGIN INITALISATION 
       jQuery(".fancybox").fancybox(); 





      }); 

     </script> 

第二個完美的作品。第一個不是。

我希望有人解決這個問題。

你能看到問題嗎? 謝謝你在前進,

Cruxy

回答

0

添加

jQuery.noConflict() 

上述第一個腳本,並嘗試...

編號:http://api.jquery.com/jquery.noconflict/

從文件中刪除所有腳本錯誤:

if yo ü不想使用的fancybox,從腳本刪除它..

+0

沒有工作使用這樣的事情。問題是一樣的 –

+0

控制檯上顯示的錯誤是什麼? (如果有錯誤) –

+0

1消息被過濾器隱藏。顯示所有訊息。 Uncaught TypeError:Object [object Object] has no method'fancybox'kledingpakket.php:1030 event.returnValue已棄用。請改用標準的event.preventDefault()。 Uncaught ReferenceError:siblingsFader未定義 –

0

嘗試,如果你正在使用jQuery 1.10.2

<script type="text/javascript"> 

$(function() { 


var portfolioCarousel = $("#widget-portfolio-2"); 

portfolioCarousel.carouFredSel({ 
    width : "100%", 
    height : "auto", 
    circular : false, 
    responsive : true, 
    infinite : false, 
    auto : false, 
    items : { 
     width : 280, 
     visible: { 
      max: 1 
     } 
    }, 
    scroll : { 
     wipe : true 
    }, 
    prev : {  
     button : "#widget-portfolio-2-prev", 
     key : "left" 
    }, 
    next : { 
     button : "#widget-portfolio-2-next", 
     key : "right" 
    }, 
    onCreate : function() { 
     $(window).on('resize', function(){ 
      portfolioCarousel.parent().add(portfolioCarousel).css('height', portfolioCarousel.children().first().outerHeight() + 'px'); 
     }).trigger('resize'); 
    } 
}); 

$('#example2').showbizpro({ 
    dragAndScroll:"off", 
    visibleElementsArray:[5,4,3,1], 
    carousel:"on", 
    heightOffsetBottom:10, 
    mediaMaxHeight:[150,150,150,150], 
    rewindFromEnd:"off", 
    autoPlay:"off", 
    delay:2000, 
    speed:750 
    }); 



// THE FANCYBOX PLUGIN INITALISATION 
$(".fancybox").fancybox(); 

}); 
</script> 
+0

現在兩者都不起作用。 –

+0

如果有任何錯誤顯示,你看起來螢火蟲嗎? –