对某些人来说,这听起来像是一个简单的问题,但我的编程技能虽然很热情,但几乎不存在。
我希望有人能提供帮助。
我正在尝试延迟以下垂直选项卡上的鼠标悬停事件,以便用户可以直接从选项卡 1 转到选项卡 4,而不会出现选项卡 2 和 3。
以下是我正在使用的脚本:
$(function () {
var items = $('#v-nav>ul>li').each(function () {
$(this).mouseover(function () {
//remove previous class and add it to clicked tab
items.removeClass('current');
$(this).addClass('current');
$('#v-nav>div.tab-content').hide().eq(items.index($(this))).show();
window.location.hash = $(this).attr('tab');
});
});
if (location.hash) {
showTab(location.hash);
}
else {
showTab("tab1");
}
function showTab(tab) {
$("#v-nav ul li:[tab*=" + tab + "]").mouseover();
}
// Bind the event hashchange, using jquery-hashchange-plugin
$(window).hashchange(function () {
showTab(location.hash.replace("#", ""));
})
// Trigger the event hashchange on page load, using jquery-hashchange-plugin
$(window).hashchange();
});
我在另一个 stackoverflow帖子中看到了类似的问题和解决方案,但无法弄清楚如何对其进行调整以使其工作。
可以在这里看到垂直选项卡的演示:http: //jsfiddle.net/JAG72/tt7CK/6/
提前感谢您的帮助。