jquery conflict between dropdown menu and ajax window

后端 未结 1 1267
南方客
南方客 2021-01-25 01:42

I have a jquery dropdown menu and an modal window which is a trigger for ajax. The problem occurs when you click on link for ajax, and when you close it dropdowns are not workin

相关标签:
1条回答
  • 2021-01-25 02:23

    You can use separate fadeIn and fadeOut functions instead of a single fadeToggle on hover and it will fix the issue:

    $(".menu-dropdown").hover(
      function(e) {
        if ($(window).width() > 943) {
          $(this).children("ul").stop(true,false).fadeIn(150);
          e.preventDefault();
        }
      },
      function(e) {
        if ($(window).width() > 943) {
          $(this).children("ul").stop(true,false).fadeOut(150);
          e.preventDefault();
        }
      }
    );
    

    CodePen here.

    0 讨论(0)
提交回复
热议问题