自动引导选项卡 [英] Automatic Bootstrap Tabs
本文介绍了自动引导选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我的引导标签自动标签,但是当单击标签时,我希望标签暂停一段时间或完全停止。这是我正在使用的javascript。
I want my bootstrap tabs to automatically tab but when a tab is clicked i want the tabbing to pause for a certain amount of time or stop completely. Here is the piece of javascript i am using.
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
});
推荐答案
如果你还没有解决它......这里是你可以检查的小提琴。
If you have not already solved it ... here is your fiddle you can check.
// 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);
});
这篇关于自动引导选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文