.mouseleave() with .delay() working together

后端 未结 3 1851
逝去的感伤
逝去的感伤 2021-01-12 05:22

I have a list of several \'triggers\' (

  • s), each trigger shows a specific DIV, and each DIV has \'close\' button.

    Now, I want to improve the us

  • 3条回答
    •  天涯浪人
      2021-01-12 05:48

      you need a duration in the hide:

      $('.copy .wrapper').delay(3000).hide('fast');

      You can take a look at the docs http://api.jquery.com/delay/

      update

      is this what your looking for?

      $('.trigger').bind("mouseenter" , function() {    
          var id = $(this).attr("data-code"); // Get the data from the hovered element
          $('.copy .wrapper:visible').fadeOut();
          $('#' + id).stop(true, true).show(); // Toggle the correct div    
          //Close button
          $('.copy .wrapper span').click(function() {
              $('.copy .wrapper').fadeOut();
          });
      });

      Thats it get rid of mouseleave listener

    提交回复
    热议问题