<!DOCTYPE html><html> <head> <title>sele1,sele2,seleN选择器</title> <script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script> <meta charset="utf-8"><style>div{ margin: 10px 0px; border: solid 1px #ccc; width: 280px;}ul{ list-style-type: none; padding: 5px; margin: 0px; display: none;}li{ margin: 3px;}h4{ background-color: #eee; padding: 5px; margin: 0px; height: 23px; line-height: 23px;}.fl{ float: left;}.fr{ float: right;}</style> </head> <body> <h3>toggle()方法的动画切换效果</h3> <div> <h4> <span class="fl">我喜欢吃的水果</span> <span class="fr" id="spnTip">显示</span> </h4> <ul> <li>苹果</li> <li>甘桔</li> <li>梨</li> </ul> </div> <script type="text/javascript"> $(function(){ var $span = $("spanTip") $("h4").bind("click",function(){ $("ul").toggle(300,function(){ $span.html() == "隐藏" ? $span.html("显示") : $span.html("隐藏"); }); }); }); </script> </body></html>
1 回答
- 1 回答
- 0 关注
- 1091 浏览
添加回答
举报
0/150
提交
取消