开发者

Expand Div with jQuery

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开发者_如何学Go, 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜