I looked around and found a solution, but I was wondering if there was a way to write simpler code. Basically, what I created just fades out, the hover effect for the image disappears.
$(document).on('mouseenter','.photos div',function () { "use strict"; $(this).find('img.nocolor').stop().animate({ 'opacity': '0' }, 800); }); $(document).on('mouseleave','.photos div',function () { "use strict"; $(this).find('img.nocolor').stop().animate({ 'opacity': '1' }, 800); });
I know that you can put mouseenter, mouseleave together, but I don't know how to structure such a switch function. Please let me know how to simplify this.
jquery
riotgear
source share