Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery event - element become visible [duplicate]

Tags:

html

jquery

css

Possible Duplicate:
jQuery event to trigger action when a div is made visible

How can I run some my code when element, wich was loaded by ajax, become visible("display" is switching from "none" to "block")? Well, I need some event like

$('#element').live('show', function(){
// CODE
});

Or event that watching for deleting/adding some class to element

like image 402
Igor Konopko Avatar asked May 14 '12 13:05

Igor Konopko


2 Answers

The problem was solved by using jquery-appear plugin

https://github.com/morr/jquery.appear

like image 169
Igor Konopko Avatar answered Oct 07 '22 10:10

Igor Konopko


There's nothing built-in jQuery that allows you to achieve that. You may take a look at the livequery plugin. For example:

$('#element').livequery(function() {
    // CODE
});

When an element with id="element" is added to the DOM the callback should be executed.

like image 24
Darin Dimitrov Avatar answered Oct 07 '22 09:10

Darin Dimitrov