dom – jQuery与ready或load事件一起生活

前端之家收集整理的这篇文章主要介绍了dom – jQuery与ready或load事件一起生活前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用jQuery Tools工具提示插件,它使用$(‘selector’)初始化.toottiti().我想在任何当前或未来的.tooltipper元素上调用它.我认为以下方法可行:
$('.tooltipper').live('ready',function(){
  $(this).tooltip()
}

但它没有成功—准备好的事件没有发生.负载相同.我已经读过livequery可以产生我正在寻找的结果,但是肯定有一种方法可以使用jQuery .live()将它拉下来,考虑到文档说它适用于所有jQuery事件,其中我相信准备就绪.

解决方法

引自jQ API( http://api.jquery.com/live/):

In jQuery 1.3.x only the following JavaScript events (in addition to custom events) could be bound with .live(): click,dblclick,keydown,keypress,keyup,mousedown,mousemove,mouSEOut,mouSEOver,and mouseup.

As of jQuery 1.4 the .live() method supports custom events as well as all JavaScript events.

As of jQuery 1.4.1 even focus and blur work with live (mapping to the more appropriate,bubbling,events focusin and focusout).

As of jQuery 1.4.1 the hover event can be specified (mapping to “mouseenter mouseleave”).

.live()似乎不支持ready事件.

猜你在找的HTML相关文章