質問

The below code works great except for one condition. If the user is hovering over the element before the doc ready, the slideToggle gets out of sync (or reversed).

So the result is the #logged_in_nav is showing on mouseout and on hover the box disappears. What is a simple method to fix this?

   $("#logged_in_box").hover(function(){
            $("#logged_in_nav").stop(true, true).slideToggle("fast");
            $(this).addClass("logged_in_box_hover");
        }, // hover over
        function() {
            $("#logged_in_nav").stop(true, true).slideToggle("fast");
            $(this).removeClass("logged_in_box_hover");
        } // hover out
    ); // hover

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top