codrops / DirectionAwareHoverEffect

How to create a direction-aware hover effect using CSS3 and jQuery. The idea is to slide in an overlay from the direction we are moving with the mouse.
397 stars 115 forks source link

error when attempting to destroy #10

Open ncavanagh opened 8 years ago

ncavanagh commented 8 years ago

when attempting to call$('.miHolder').each(function(){$(this).hoverdir('destroy'); } ); gives an error "cannot call methods on hoverdir prior to initialization; attempted to call method 'destroy'"

The reason for the .each is the hoverdiv() only gets applied to the first .miHolder, even when using $("#miTHumbs > li").hoverdiv(). So my initialization line is: $('.miHolder').each(function(){$(this).hoverdir(); } ); And this line is call long before I try to run the destroy. and even if I run the line in an inspector console I still get the error. Even If I use a non .each() initialization I still get the same error when trying a 'destroy'

why is this error occurring, what would prevent the elements from being recognized as initialized?

Thank you, -N8

ncavanagh commented 8 years ago

In an inspector console I just tired running $(' #da-thumbs > li ').each( function() { $(this).hoverdir('destroy'); } ); on your demo at http://tympanus.net/TipsTricks/DirectionAwareHoverEffect/ and received the error and the hover effect remained.