tags:

views:

86

answers:

1

I like to do something terribly simple

Had a div that show only a little bit of image click on div, expand to the image height reclick on it, contract to to original height

Now, my test is not concluant ! so many problems !, is there a simpler method around ?

link on some funny result !

mostly as this

+1  A: 

The best way to do this is to have a handle, which toggles a panel:

<div class="block">
  <div class="handle">Click Me</div>
  <div class="panel">
    <img src="bigImage.jpg" />
  </div>
</div>

And then something like:

$(".handle").click(function(){
  $(this).next().slideToggle();
});

Not only is this simple, but it's predictable, and won't leave the user confused about the behavior.

Jonathan Sampson
i come to the same solution..... because the image disapear... so handle it's the way i will go !
marc-andre menard
do i really have to wrap everything in a block div ?
marc-andre menard
It's cleaner that way.
Jonathan Sampson
@marc-andre menard: You could also animate the height. I've setup an example here: http://jsbin.com/ajoyi3/edit
Jonathan Sampson