Jquery Stop Fadein / Fadeout

后端 未结 5 869
走了就别回头了
走了就别回头了 2020-12-08 08:00

This is a fairly easy one, but I cant seem to figure it out.

Basically I have a jquery hover that fades in a div and fades out the other upon hover.

When I

5条回答
  •  失恋的感觉
    2020-12-08 08:37

    In times like this I turn to Brian Cherne's genius .hoverIntent() plugin -- It's quite smooth...waits until the user has slowed down enough before executing. You can configure it to your needs.

    Just include the plugin (it's short enough I'll sometimes place it directly into my script file) then add the word Intent:

    $(".txtWrap").hoverIntent(
      function () {
        $(this).find('.txtBock').fadeOut();
        $(this).find('.txtDesc').fadeIn();
    
      },
      function () {
        $(this).find('.txtBock').fadeIn();
        $(this).find('.txtDesc').fadeOut();
      }
    )
    

提交回复
热议问题