2014-04-28 109 views
0

我已經使用jQuery Scrollbox。它在當地工作良好,但不在生產中工作。腳本不工作jQuery滾動條

enter image description here

這裏是我的代碼的jQuery

$(function() { 
$('#demo').scrollbox({ 
linear: false, // Scroll method 
startDelay: 2, // Start delay (in seconds) 
delay: 2, // Delay after each scroll event (in seconds) 
step: 5,// Distance of each single step (in pixels) 
speed: 32, // Delay after each single step (in milliseconds) 
switchItems: 1, // Items to switch after each scroll event 
direction: 'scrollLeft', 
distance: 'auto', 
autoPlay: true, 
onMouseOverPause: true, 
paused: false, 
queue: null 
}); 

}); 

$(function() { 
$('#demo1').scrollbox({ 
linear: false, // Scroll method 
startDelay: 3, // Start delay (in seconds) 
delay: 2, // Delay after each scroll event (in seconds) 
step: 5,// Distance of each single step (in pixels) 
speed: 32, // Delay after each single step (in milliseconds) 
switchItems: 1, // Items to switch after each scroll event 
direction: 'scrollLeft', 
distance: 'auto', 
autoPlay: true, 
onMouseOverPause: true, 
paused: false, 
queue: null 
}); 
}); 

其完全卡住。如何解決這個問題?

+0

在實時環境中訪問時檢查控制檯錯誤消息。 – abc

+0

其工作正常..沒有錯誤 –

+1

我檢查了您提供的鏈接,並查看錯誤消息的控制檯。似乎沒有jQuery的參考。仔細檢查你的jQuery庫。 – abc

回答

1

問題出在您的腳本上。看來你必須添加下面一行:

<script> 
    jQuery(document).ready(function(){ 
     $('.page_of_paginationpagination_count_ba').appendTo('#owner_block_submenu_tree'); 
    }); 
</script> 

您需要添加一個$作爲函數參數:

<script> 
    jQuery(document).ready(function($){ 
     $('.page_of_paginationpagination_count_ba').appendTo('#owner_block_submenu_tree'); 
    }); 
</script> 

否則,瀏覽器不知道什麼$是 - $是jQuery的,但你不定義是作爲函數參數。添加這些或使用jQuery(...)而不是$(...)

<script> 
    jQuery(document).ready(function(){ 
     jQuery('.page_of_paginationpagination_count_ba').appendTo('#owner_block_submenu_tree'); 
    }); 
</script>