开发者

How can I detect which easings are available in jQuery?

开发者 https://www.devze.com 2023-02-16 17:33 出处:网络
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.

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'
    }
);
0

精彩评论

暂无评论...
验证码 换一张
取 消