benbarnett / jquery-animate-enhanced

Extend $.animate() to detect CSS transitions for Webkit, Mozilla, IE>=10 and Opera and convert animations automatically.
http://playground.benbarnett.net/jquery-animate-enhanced/
MIT License
1.39k stars 196 forks source link

Added check for already hidden elements #150

Closed Blackskyliner closed 1 year ago

Blackskyliner commented 10 years ago

Fix for #128

It is just needed for fadeOut elements, as for fadeIn it seems to work flawless, even on subsequent calls to fadeIn. At least in the tests I did, if someone could provide another where it does not work just post.

Problem for fadeIn or better 'prop.opacity == show' its not so easy to bypass as we would want to do CSS while opacity >= 0 to 'show' or to another opacity. We could at least check for

prop.opacity === 'show' && jQuery(this).css('opacity') === 1

but as this would add even more overhead I would suggest just to add it if it is really needed, aka some simple test example which shows the callback not to work for subsequent fadeIn's.

I think the place seems right, as we won't have called the whole cssCallback magic. It adds a bit stress though, because we need to encapsulate the DOM element inside jQuery to check for ':hidden'