开发者

How can I modify my plugin to work with hoverIntent if it is available?

I hav a plu开发者_Python百科gin that uses hover() but it should use hoverIntent() if it is available.

How would I do this with minimum fuss?


This will detect if hoverIntent has been included, and modify the hover method to hoverIntent in that case.

var bindMethod = $.isFunction(jQuery().hoverIntent) ? 'hoverIntent' : 'hover';

element[bindMethod](
function() {
  // Mouse over
},
function() {
  // Mouse out
});

You can then leave a note with your plugin that says...

  • Compatible with hoverIntent.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜