/ Published in: jQuery
this is coded by paul irish i just post it for future reference to me and my co-workers
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// OMFG NO $('.unit').hover(function () { $(this).addClass('unit-hover'); $(this).children('.thumb').children('a').children('.thumb_BW').addClass('hidden'); $(this).children('.thumb').children('a').children('.thumb_C').removeClass('hidden'); $(this).children('.arrow-details').removeClass('hidden'); }, function () { $(this).removeClass('unit-hover'); $(this).children('.thumb').children('a').children('.thumb_C').addClass('hidden'); $(this).children('.thumb').children('a').children('.thumb_BW').removeClass('hidden'); $(this).children('.arrow-details').addClass('hidden'); }); // HELL YA $('.unit').hover(function (e) { var isIn = e.type === 'mouseenter', $this = $(this); $this.toggleClass('unit-hover',isIn); $this.find('.thumb a') .children('.thumb_BW').toggleClass('hidden',isIn) .end() . children('.thumb_C').toggleClass('hidden',!isIn); $this.children('.arrow-details').toggleClass('hidden',!isIn); });