views:

28

answers:

1

Not sure if this can be done, but I would like to toggle an image (easy) BUT at the same time increase/decrease the height of another div based on the "open/close" of the toggle. I can get it to increase on click, but not on the "close" any suggestions please

$j('#headerImageToggle').live('click',function(){
$j(this).next('div').slideToggle('slow',function(){
I assume something goes in here?
});
});
+2  A: 
$j('#headerImageToggle').live('click',function(){
  var nextDiv = $j(this).next('div');
  nextDiv.slideToggle('slow',function() {
    if (nextDiv.is(':visible')) {
      // decrease height
    } else {
      // increase height
    }
  });
});
Mark
Thanks Mark, works a treat, sorry can't accept answer for another 8 mins. Will accept yours a bit later.