I have a div and I'd like to have an event handler listen to when it becomes visible and hidden. How do you do that?
Thanks.
You can use the callback parameter in the show()
and hide()
methods like this:
$('#myDiv').show(0, onDivShow);
$('#myDiv').hide(0, onDivHide);
function onDivShow() { //your code here }
function onDivHide() { //your code here }
See a working example here: http://jsfiddle.net/N7UNU/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With