admin管理员组文章数量:1336563
In jQuery, I'm hiding my elements using .hide();
.
Is there an evert handler that is fired when I hide something? You see, I have a bunch of elements in my code, and I'm hiding them or showing them (using jQuery) a bunch of times. To keep things in check, in an efficient way, I would love to use an event handler for .hide()
Could someone point me in the right direction for this?
Many Thanks!
In jQuery, I'm hiding my elements using .hide();
.
Is there an evert handler that is fired when I hide something? You see, I have a bunch of elements in my code, and I'm hiding them or showing them (using jQuery) a bunch of times. To keep things in check, in an efficient way, I would love to use an event handler for .hide()
Could someone point me in the right direction for this?
Many Thanks!
Share edited Mar 30, 2012 at 1:48 Greg Pettit 10.8k5 gold badges57 silver badges73 bronze badges asked Mar 30, 2012 at 1:15 Umm....Umm.... 792 silver badges7 bronze badges 2- 1 You can provide a callback for hide() if you want, but I don't think this is what you are looking for. Can you please explain what you are trying to achieve? – Niyaz Commented Mar 30, 2012 at 1:19
-
There is no
onhide
event, its a custom method from jQuery which uses animations to create a "hiding" effect on the element. – mowwwalker Commented Mar 30, 2012 at 1:24
3 Answers
Reset to default 4You can use a callback function
$('#element').hide('slow', hideCallback);
$('#element').show('slow', showCallback);
function hideCallback()
{
// You can do your stuff here
}
function showCallback()
{
// You can do your stuff here
}
$('p').on('ohWowIGotHidden', function(){
document.write('O look, it works');
});
$('p').hide(function(){
$(this).trigger('ohWowIGotHidden');
});
You can create a custom event and trigger it whenever you call the hide method..
You can override hide in jquery to dispatch an event after calling the original function.
本文标签: javascriptjQuery onhide event handlerStack Overflow
版权声明:本文标题:javascript - jQuery onhide event handler - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742403389a2468330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论