开发者

animate a div to a specific value with slideToggle() (more/less function)

开发者 https://www.devze.com 2023-03-02 03:06 出处:网络
<script> $(document).ready(function(){ $(\"a\").click(function(){ $(\"div\").slideToggle(\"slow\");
<script>
$(document).ready(function(){
$("a").click(function(){
$("div").slideToggle("slow");
});
});
</script>

<div style="height:240px; width:320px; border:1px solid tan; background:beige; padding:10px">text</div>
<a href=javascript:;>more/le开发者_Python百科ss</a>

hi coder, i want to toogle a div from 80px/320px to 240px/320px with animate. is this possible with slideToggle() or do i need an own function? best regards


You can use toggleClass() and pass in a number for the speed of animation.

jsFiddle.

Keep in mind this requires jQuery UI.

0

精彩评论

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