Javascript Scroll Menu - MouseOver Selection not working correctly on first contact

流过昼夜 提交于 2019-12-10 12:19:55

问题


I am currently working with a tab menu which cycles through automatically. Once I mouseover one of the tabs the "rotation" should stop on the selected tab and when I mouseout it should continue rotating from the selected tab item.

$(document).ready(function() {

$("#featured > ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 1000, true);

$("#featured > ul").mouseover(function() {
    $(this).tabs({ event: 'mouseover', fx: { opacity: "toggle"} }).tabs("rotate", 0);
})

$("#featured > ul").mouseout(function() {
    $(this).tabs("rotate", 1000);
})
});

At the moment the when MouseOver the cycle stops but does not select the correct item, once I mouseOut then MouseOver again the functionality works perfectly! My issue lies where on first mouseOver the code doesnt seem to be loading correctly?

Any ideas? Help will be really appreciated.

Thanks again for your time..


回答1:


Try this:

$("#featured > ul").mouseover(function() {
    $(this).tabs("abort");
    $(this).tabs({ event: 'mouseover', fx: { opacity: "toggle"} }).tabs("rotate", 0);
    $(this).tabs("select", this.id); 
});


来源:https://stackoverflow.com/questions/2333511/javascript-scroll-menu-mouseover-selection-not-working-correctly-on-first-cont

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!