JQuery/Javascript/DOM可见性事件 [英] JQuery/Javascript/DOM Visibility Event
本文介绍了JQuery/Javascript/DOM可见性事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一般来说,我可以订阅的JQuery,Javascript或DOM中是否有一个事件可以在元素变为可见或不可见(display:none)时通知我?
Is there an event in JQuery, Javascript, or the DOM in general that I can subscribe to that will notify me when an element become visible or invisible (display:none)?
推荐答案
有些DOMAttrModified和onpropertychange(IE)事件可以跟踪DOM元素更改并触发事件.
There are events for DOMAttrModified and onpropertychange (IE) that can track DOM element changes and fire an event.
使用jQuery插件编写有关此内容的信息,该插件可在此处监视CSS样式的更改:
Wrote about this with a jQuery plug-in that allows monitoring changes to CSS styles here:
http://www.west-wind.com/weblog/posts/478985.aspx
这可能正是您需要的,因为您可以执行以下操作:
This might be just what you need as you could do something like:
$("#myControl").watch("display,visibility", function() { showStatus("changed...") });
这篇关于JQuery/Javascript/DOM可见性事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文