开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜