Posted By

root_hacker on 07/07/11


Tagged

mouse hover over


Versions (?)

jQuery hover by paul irish


 / Published in: jQuery
 

this is coded by paul irish i just post it for future reference to me and my co-workers

  1. // OMFG NO
  2. $('.unit').hover(function () {
  3. $(this).addClass('unit-hover');
  4. $(this).children('.thumb').children('a').children('.thumb_BW').addClass('hidden');
  5. $(this).children('.thumb').children('a').children('.thumb_C').removeClass('hidden');
  6. $(this).children('.arrow-details').removeClass('hidden');
  7. }, function () {
  8. $(this).removeClass('unit-hover');
  9. $(this).children('.thumb').children('a').children('.thumb_C').addClass('hidden');
  10. $(this).children('.thumb').children('a').children('.thumb_BW').removeClass('hidden');
  11. $(this).children('.arrow-details').addClass('hidden');
  12. });
  13.  
  14.  
  15.  
  16. // HELL YA
  17. $('.unit').hover(function (e) {
  18. var isIn = e.type === 'mouseenter',
  19. $this = $(this);
  20.  
  21. $this.toggleClass('unit-hover',isIn);
  22. $this.find('.thumb a')
  23. .children('.thumb_BW').toggleClass('hidden',isIn)
  24. .end()
  25. . children('.thumb_C').toggleClass('hidden',!isIn);
  26.  
  27. $this.children('.arrow-details').toggleClass('hidden',!isIn);
  28. });

Report this snippet  

You need to login to post a comment.