jquery - Fade In/Out Background Image with Another Image / fade out other elements -
i'm having trouble fadein/out of elements. need have several divs, fade in new background, text when hovered over. need have other divs fade out some, while i'm hovered on element.
i can fade out other elements if i'm hovered on element, rest of problem cannot figure out.
i want specific divs affected have other divs (id , classes) on page.
here fiddle: http://jsfiddle.net/deelite/snvmr/2/
my jquery:
$('div').hover(function() { $('div').not($(this)).stop().fadeto(500, 0.33); }, function() { $('div').stop().fadeto(500, 1); });
i'm not sure how else proceed.
just use .not(this)
; .not($(this))
incorrect. had couple other errors. can add class (e.g., .effect
) the div
s want apply effect to.
html:
<div class="effect one"><p>me</p></div> <div class="effect two"><p>have</p></div> <div class="effect three"><p>fun</p></div>
jquery:
$('.effect').hover( function() { $('.effect').not($(this)).stop().fadeto(500, 0.33); }, function() { $('.effect').stop().fadeto(500, 1); } );
fiddle: http://jsfiddle.net/snvmr/5/
Comments
Post a Comment