jQuery Drop Down Hover Menu

前端 未结 7 1009
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 06:44

I\'m new to jQuery, I was hoping you guys could help me. I\'m trying to make a hover dropdown menu, but it\'s extremely buggy. Can you help me clean up my Javascript? Loo

7条回答
  •  难免孤独
    2020-12-29 07:24

    Use the finish function in jQuery to prevent the bug where you rapidly hover your mouse over the menu and out of the menu. Finish is better than the stop function previously suggested.

    $(document).ready(
        function () {
            $(".hoverli").hover(
              function () {
                 $('ul.file_menu').finish().slideDown('medium');
              }, 
              function () {
                 $('ul.file_menu').finish().slideUp('medium');
              }
        );
    });
    

提交回复
热议问题