Ror*_*yne 4 javascript twitter-bootstrap
我希望我的引导标签自动标签,但是当单击标签时,我希望标签暂停一段时间或完全停止.这是我正在使用的javascript.
var timer = null,
interval = 1000,
value = 0;
$("#start").click(function() {
if (timer !== null) return;
timer = setInterval(function () {
value = value+1;
$("#input").val(value);
}, interval);
});
$("#stop").click(function() {
clearInterval(timer);
timer = null
});
Run Code Online (Sandbox Code Playgroud)
小智 9
如果你还没有解决它...这是你可以检查的小提琴.
// Tab click event handler
$('a').on('click', function (e) {
e.preventDefault();
// Stop the cycle
clearInterval(tabCycle);
// Show the clicked tabs associated tab-pane
$(this).tab('show');
// Start the cycle again in a predefined amount of time
setTimeout(function () {
//tabCycle = setInterval(tabChange, 5000);
}, 15000);
});
Run Code Online (Sandbox Code Playgroud)