jQuery hoverIntent not working, but hover does

后端 未结 1 1790
心在旅途
心在旅途 2021-01-16 13:10

I have the following code:

$(document).ready(function(){
    $(\".yearInner\").hide();

    $(\".year\", this).hover(
        function () {
            $(\".         


        
相关标签:
1条回答
  • 2021-01-16 14:02

    You need to split the hover/leave callbacks to use that plugin, like this:

    $(".year", this).hoverIntent(function () { 
       $(".yearInner", this).slideDown();
    }, function() {
       $(".yearInner", this).slideUp("fast"); 
    });
    

    Not sure why there isn't an override like jQuery has in core that accepts a single function to run in both cases, but this is the fix. Note: .slideToggle() still works just fine, I just added a bit of variety in.

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