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
  • 58,320
  • 7
  • 77
  • 95

2 Answers2

2

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

$('div.withSomeclass').trigger('appear');
Adil Shaikh
  • 44,509
  • 17
  • 89
  • 111
  • 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
  • 18,333
  • 14
  • 83
  • 102