jQuery fading in an element - not working exactly as i want it to...

Posted by Nike on Stack Overflow See other posts from Stack Overflow or by Nike
Published on 2010-03-19T18:58:54Z Indexed on 2010/03/19 19:01 UTC
Read the original article Hit count: 345

Filed under:
|

Anybody see what's wrong? Doesn't seem to do anything. If i replace

$(this, '.inner').stop(true, false).fadeIn(250);

with

$(.fadeInOnHover .inner').stop(true, false).fadeIn(250);

then all the .inner elements on the page will fade in (which isn't really what i want, as i have ~10 of them). I know it's possible to achieve what i want to do, but i don't know how in this case. Thanks in advance :)

<script type="text/javascript">
$(document).ready(function() {
 $('.fadeInOnHover .inner').css("display","none");

 $('.fadeInOnHover').hover(function() {
  $(this, '.inner').stop(true, false).fadeIn(250);
 }).mouseout(function() {
  $(this, '.inner').stop(true, true).fadeOut(100);
 });
});
</script>

© Stack Overflow or respective owner

jQuery fading in an element - not working exactly as i want it to...

Posted by Nike on Super User See other posts from Super User or by Nike
Published on 2010-03-19T18:49:59Z Indexed on 2010/03/19 19:01 UTC
Read the original article Hit count: 345

Anybody see what's wrong? Doesn't seem to do anything. If i replace

$(this, '.inner').stop(true, false).fadeIn(250);

with

$(.fadeInOnHover .inner').stop(true, false).fadeIn(250);

then all the .inner elements on the page will fade in (which isn't really what i want, as i have ~10 of them). I know it's possible to achieve what i want to do, but i don't know how in this case. Thanks in advance :)

<script type="text/javascript">
$(document).ready(function() {
 $('.fadeInOnHover .inner').css("display","none");

 $('.fadeInOnHover').hover(function() {
  $(this, '.inner').stop(true, false).fadeIn(250);
 }).mouseout(function() {
  $(this, '.inner').stop(true, true).fadeOut(100);
 });
});
</script>

© Super User or respective owner

Related posts about jQuery

Related posts about animation