Posted By

root_hacker on 04/12/11


Tagged

jquery best


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Lizzychang


juqery : toggling with mouse hover in and out


 / Published in: JavaScript
 

this is the way for toggling something on mouse hover in and out

  1. // HELL YA
  2. $('.unit').hover(function (e) {
  3. var isIn = e.type === 'mouseenter',
  4. $this = $(this);
  5.  
  6. $this.toggleClass('unit-hover',isIn);
  7. $this.find('.thumb a')
  8. .children('.thumb_BW').toggleClass('hidden',isIn)
  9. .end()
  10. . children('.thumb_C').toggleClass('hidden',!isIn);
  11.  
  12. $this.children('.arrow-details').toggleClass('hidden',!isIn);
  13. });

Report this snippet  

You need to login to post a comment.