Search Results

Search found 1 results on 1 pages for 'user494118'.

Page 1/1 | 1 

  • Expand and collapse a div

    - by user494118
    I have a list of itens and they are holding images, each image is 800w x 600 H. The original div height is 800 W x 300 H, I figured out how to expand the div when it is clicked, but i want to know how to collapse it when you click it while it is already expanded. right now it just expands the div even farther $('.expand').bind('click', function() { var currHeight = $(this).css('height').replace(/px/,''); currHeight = currHeight * 1; var newHeight = currHeight + 500; $(this).animate({ height: newHeight },1000); }); any idea on how to create an if else statement that would say, IF the div is already expanded then collapse on click, or if the div is not expanded, expand to # of px.

    Read the article

1