briancherne / jquery-hoverIntent

hoverIntent jQuery Plug-in
https://briancherne.github.io/jquery-hoverIntent/
MIT License
826 stars 253 forks source link

Is it work with dynamically added element? #62

Closed themenow closed 7 years ago

themenow commented 7 years ago

I tried the following code but no luck

$(document).on('mouseenter.hoverIntent', element, function() {});

twidi commented 7 years ago

As showed on https://briancherne.github.io/jquery-hoverIntent/, you should do something like

$(document).hoverIntent(
    function() { console.log('in') },
    function() { console.log('out') },
    'selector'
)

It's what I do and it works on elements present at first and dynamically added ones

usmonster commented 7 years ago

Thanks @twidi for responding! :)

@kamiyeye, I'll close this issue for now, but please comment again if you think you've found a bug or limitation in the plug-in, or if you have any other directly-related follow-up question.

twidi commented 7 years ago

@usmonster: you're welcome, I just started using this plugin and as always, I do a quick check on issues and pull requests to know the actual defects, and seen this, as I just did it in my code, so... :)