使用jquery怎么实现一个侧边栏左右伸缩效果(jquery,web开发)

时间:2024-05-05 13:27:14 作者 : 石家庄SEO 分类 : web开发
  • TAG :

具体代码如下:

<!DOCTYPEhtml><html> <head> <metacharset="utf-8"/> <title></title> <scriptsrc="js/jquery.js"type="text/javascript"charset="utf-8"></script> <style> *{margin:0;padding:0;} #box{width:100%;height:100%;} #left{width:200px;float:left;background-color:royalblue;position:relative;} #btn{width:100%;height:50px;background-color:darkgoldenrod;line-height:50px;text-align:center;color:white;cursor:pointer;} #btnb{width:50px;height:50px;background-color:red;position:absolute;cursor:pointer;left:-50px;line-height:50px;text-align:center;} </style> </head> <body> <divid="box"> <divid="left"> <divid="btn">收缩</div> </div> <divid="btnb"> 显示 </div> </div> <scripttype="text/javascript"> $(function(){ $a=$(window).height(); $("#left").height($a); $("#btn").click(function(){ $("#left").animate({left:'-200px'}); $("#btnb").delay(500).animate({left:'0'}); }); $("#btnb").click(function(){ $("#btnb").animate({left:'-50px'}); $("#left").delay(500).animate({left:'0'}); }); }); </script> </body></html>

效果图:

使用jquery怎么实现一个侧边栏左右伸缩效果

 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:使用jquery怎么实现一个侧边栏左右伸缩效果的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:使用mongoose怎么对对象进行更新下一篇:

7 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18