250 61 | I'm using jQuery in my site and I would like to trigger certain actions when a certain div is made visible. Is it possible to attach some sort of "isvisible" event handler to arbitrary divs and have certain code run when they the div is made visible? I would like something like the following pseudocode:
The alert("do something") code should not fire until the contentDiv is actually made visible. Thanks. | ||||
|
167 | You could always add to the original .show() method so you don't have to trigger events every time you show something or if you need it to work with legacy code: Jquery extension:
Usage example:
This effectively lets you do something beforeShow and afterShow while still executing the normal behavior of the original .show() method. You could also create another method so you don't have to override the original .show() method. | ||||||||||||||||||||
|
'WEB > jQuery' 카테고리의 다른 글
How to count check-boxes using jQuery? (0) | 2018.01.22 |
---|---|
jQuery checkbox values to comma separated list (0) | 2018.01.22 |
[Javascript] 숫자 3자리 단위마다 콤마(comma) 찍기 (0) | 2018.01.14 |
jQuery Change Image src with Fade Effect (0) | 2018.01.14 |
jQuery change() Method (0) | 2018.01.14 |