So far I tried onHide() type event in jQuery
Asked
Active
Viewed 3,045 times
-5
-
what is expected, what happens ? – Frederik.L Jan 12 '13 at 05:22
-
2Please elaborate on your question. – Eli Jan 12 '13 at 05:22
3 Answers
3
This plugin will be able to detect the style change and notify you: jQuery Style Listener
You can use it like:
$('#yourElement').styleListener({
// the styles that you want to monitor for changes
styles: ['display'],
// function to be called when a monitored style changes
changed: function(style, newValue, oldValue, element) {
if(style == 'display' && newValue == 'none') {
// element got hidden, do your stuff
}
}
});
Demo: http://jsfiddle.net/vaxQX/
Disclaimer: I am the author of the plugin.

techfoobar
- 65,616
- 14
- 114
- 135
-
-
@roXon - Yes. Testing is still in progress. Also a few other styles like opacity in older versions of IE need fine tuning. :-) – techfoobar Jan 12 '13 at 05:32
-
I plan to make it compatible with almost all styles within 2 to 3 revisions. – techfoobar Jan 12 '13 at 05:33
-
well, wht to say but a brave and good job. +1 Keep up with your work! thumbs up – Roko C. Buljan Jan 12 '13 at 05:34
0
You can provide a callback function on the function that gets hidden.
$('div').hide(function(){
// do something
});
Not sure if this will work for what you want, but the function will only fire once hide is complete.

PlantTheIdea
- 16,061
- 5
- 35
- 40
0
you can use http://api.jquery.com/promise/ :
http://jsbin.com/evajiv/1/edit
$('#test').click(function(){
$(this).hide(); // I USED .fadeTo() in the demo
$(this).promise().done(function( ) {
alert( 'HIDDEN!' );
});
});
or in a classic way:
function fn(){
alert('DONE!');
}
$('#test').click(function(){
$(this).hide(fn); // use callback
});

Roko C. Buljan
- 196,159
- 39
- 305
- 313