我希望我的引导程序选项卡自动显示选项卡,但是当单击某个选项卡时,我希望该选项卡暂停一段时间或完全停止。这是我正在使用的一段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
});
如果您还没有解决它,这是您的小提琴,您可以检查一下。
// 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);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句