2

I want to trigger a cutom event everytime an element is made visible .

ANy idea how i can achieve that i

Manish Basdeo
  • 6,139
  • 22
  • 68
  • 102
  • 1
    Is it your code doing the showing and hiding, or do you want to catch when some other code out fo your control shows and hides things? – loganfsmyth Feb 05 '12 at 20:05
  • You must have already got a solution. But for others here's the link :http://stackoverflow.com/questions/1225102/jquery-event-to-trigger-action-when-a-div-is-made-visible – Rajat Gupta Dec 11 '13 at 10:06

2 Answers2

-1

your question is not appropriate enough to receive answers but according to what i am guessing try this..

Once your element become visible add a class to it by using

$('some_element').addClass('isvisible');

then make a check if your element has that class isvisible than trigger your event

if('some_element').hasClass('isvisible'){
        // your triggger
  }
Aman Virk
  • 3,909
  • 8
  • 40
  • 51
-2

Just trigger the event whenever you show or make the element visible. You can use trigger method to trigger the custom events on an element.

$('elementSelector').trigger('customEvent');
ShankarSangoli
  • 69,612
  • 13
  • 93
  • 124