开发者

Expand Div with jQuery

开发者 https://www.devze.com 2022-12-17 08:13 出处:网络
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

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

精彩评论

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