2013-01-16 58 views
0

我正在使用jQuery vTicker滚动我的新闻项目。jQuery vTicker停止自动播放

这是脚本:

$(document).ready(function() { 
    $('.tx_newsitems').vTicker({ 
    speed: 500, 
    pause: 3000, 
    animation: 'none', 
    mousePause: true, 
    height: 0, 
    direction: 'up', 
    }); 
}); 

实际的问题是,我需要在这个插件停止自动播放。可能吗? 是否这样的代码autoplay:false,

+0

增加暂停.. :) :) – bipen

+0

据GitHub的自述,你可以使用isPaused得到: https://github.com/richhollis/vticker有帮助吗? –

+0

显然有一个选项暂停它在这里暂停鼠标悬停在一个单独的按钮上的示例。您可以通过https://github.com/richhollis/vticker查看 – ryadavilli

回答

0

你需要初始化后vTicker功能添加代码:

$("#id of stop/start - button").toggle(function(){ 
    $('.tx_newsitems').vTicker('pause', true); 
},function(){ 
    $('.tx_newsitems').vTicker('pause', false); 
}); 

像这样:

$(document).ready(function() { 
    $('.tx_newsitems').vTicker({ 
    speed: 500, 
    pause: 3000, 
    animation: 'none', 
    mousePause: true, 
    height: 0, 
    direction: 'up', 
    }); 

    $("#stop_start_button").toggle(function(){ 
    $('.tx_newsitems').vTicker('pause', true); 
    },function(){ 
    $('.tx_newsitems').vTicker('pause', false); 
    }); 
});