Return to Snippet

Revision: 48675
at July 7, 2011 16:11 by root_hacker


Initial Code
// 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);
});

Initial URL

                                

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

Initial Title
jQuery hover by paul irish

Initial Tags

                                

Initial Language
jQuery