脚本不工作jQuery滚动框

时间:2014-04-28 09:54:42

标签: javascript php jquery html

我使用过jQuery Scrollbox。它在当地工作,但不在生产。

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
});
});

它完全卡住了。如何解决这个问题?

1 个答案:

答案 0 :(得分: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>