2013-01-16 57 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); 
    }); 
});