0

This is purely out of curiosity.

Is there any actual code for doing this in jquery?

$('div.withSomeclass').on('appear',function(){
  // do something
});

UPDATE: Sorry, I wasn't complete in my question

What I'm trying to do is, whenever a DOM element is added do something with it. Not only when clicking it or something like that. As soon as the element with the selector (div.withSomeclass) is added, I want to do something with it.

Amit Joki
  • 56,285
  • 7
  • 72
  • 91

2 Answers2

2

Yes, you can trigger your custom event with .trigger()

$('div.withSomeclass').trigger('appear');
Mohammad Adil
  • 44,013
  • 17
  • 87
  • 109
  • maybe the same question here : [jquery-event-to-trigger-action-when-a-div-is-made-visible](http://stackoverflow.com/questions/1225102/jquery-event-to-trigger-action-when-a-div-is-made-visible) ? – Intuitisoft Mar 31 '14 at 08:04
0

You can try this jQuery plugin to achieve

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

You can check live demo here http://morr.github.io/appear.html

Subodh Ghulaxe
  • 17,943
  • 14
  • 81
  • 99