jQuery Golden Rule:  If you are using an IF statement or an ID, then there
is an easier way.

Reference:
http://docs.jquery.com/DOM/Traversing/Selectors
Use: :visible in the selector itself.
Relative pathing.
siblings()
not()
slideToggle()
http://docs.jquery.com/Effects#slideToggle.28_speed.2C_callback_.29

This is tested code and works.  Looks like it does what you want.

<script type="text/javascript">
 $(document).ready(function(){

  $("div.anirec_buttons li img").click( function() {  //bind click
functions
    $("div.anirec_more:visible").not($(this).parents("div.anirec_main
").siblings("div.anirec_more")).slideUp(400); //hide everything NOT the
target
    
$(this).parents("div.anirec_main").siblings("div.anirec_more").slideToggle(400);
//TOGGLE the target
  } );

 });

</script>

<style>
div.anirec_buttons li img {cursor:pointer}
div.anirec_more {display:none;}
</style>
I think the code could be much shorter if I used a variable for the Target,
but I have to get to work.


Glen
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to