jQuery Syntax Question, pretty easy I think..

Posted by Fuego DeBassi on Stack Overflow See other posts from Stack Overflow or by Fuego DeBassi
Published on 2010-06-05T22:15:51Z Indexed on 2010/06/05 22:22 UTC
Read the original article Hit count: 175

Filed under:
|

Hi all, question:

<script type="text/javascript">
 $(document).ready(function() {
  $(".module .caption").hide();
  $(".module").hover(function() {
     $(this).find(".caption").slideDown(); 
   },function() {
     $(this).find(".caption").slideUp();   
   });
 });
</script>

This snippet works great for my purposes, the only caveat is that I need the .module hover function to simultaneously add a class of "under" to all other ".caption"'s that are not $this, and then remove them when the hover ends. So basically I don't want the "module" that is hovered to get the class, I want it to do exactly what I am showing here...sliding .caption up and down on end hover, I just want all other ".caption"s to get the under class when any ".module" is hovered.

Just hitting a dead end with what I have been trying, want to do it in the same function. Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about show-hide