juqery : toggling with mouse hover in and out


/ Published in: JavaScript

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.