Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery/Javascript/DOM Visibility Event

Tags:

jquery

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)?

like image 366
Adam Ritenauer Avatar asked Jun 02 '09 18:06

Adam Ritenauer


1 Answers

There are events for DOMAttrModified and onpropertychange (IE) that can track DOM element changes and fire an event.

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...") });
like image 162
Rick Strahl Avatar answered Oct 06 '22 20:10

Rick Strahl