How can I detect which easings are available in jQuery?
I am writing a plugin and I need to detect if an easing is avaiable, as referencing one which isn't causes the plugin to fail.
If the easing isn't present, I'm going to fallback to swing
.
So,开发者_Python百科 how can I figure this out?
jQuery.easing
has them.
if ('easeOutBounce' in jQuery.easing) {
// Good to go
}
Example
$(this).animate(
{
bottom: 0
},
{
duration: 100,
easing: 'easeOutCubic' in $.easing ? 'easeOutCubic' : 'swing'
}
);
精彩评论