下拉和收缩类似的效果应用非常的频繁,本章节简单介绍一下如何实现此效果。
代码实例如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <head> <title>蚂蚁部落</title> <style type="text/css"> body{ margin:0 auto; padding:0; width:570px; font:75%/120% Arial, Helvetica, sans-serif; } a:focus{ outline:none; } #panel{ background:#69C7F7; height:200px; display:none; } .slide{ margin:0; padding:0; border-top:solid 4px #F27613; } .btn-slide{ background:#F27613 url(mytest/jQuery/20121225165932118.gif) no-repeat right -50px; text-align:center; width:144px; height:31px; padding:10px 10px 0 0; margin:0 auto; display:block; font:bold 120%/100% Arial, Helvetica, sans-serif; color:#fff; text-decoration:none; } .active{ background-position:right 12px; } </style> <script type="text/javascript" src="http://www.softwhy.com/mytest/jQuery/jquery-1.8.3.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn-slide").click(function(){ $("#panel").slideToggle("slow"); $(this).toggleClass("active"); return false; }) }) </script> </head> <body> <div style="display: block;" id="panel"></div> <p class="slide"> <a href="javascript:;" rel="external nofollow" class="btn-slide active">点击查看效果</a> </p> </body> </html>
以上代码实现了下拉和收缩效果,代码比较简单,这里就不多介绍了。
最后
以上就是无情人生最近收集整理的关于jquery实现的下拉和收缩效果示例的全部内容,更多相关jquery实现内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复