zoukankan      html  css  js  c++  java
  • jquery动画

    <a href="javascript:void(0)" id="show">show</a>
    javascript:void(0) 防止页面单击以后会跳走,让他为空
    jquery 动画库下载地址

    <script src="js/jquery.easing.1.3.js"></script>
    引入即可使用
    此网站查看动画效果

    点击显示就显示,点击隐藏就隐藏
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. }
    12. </style>
    13. <script src="js/jquery-1.11.2.min.js"></script>
    14. <script src="js/jquery.easing.1.3.js"></script>
    15. <script>
    16. $(document).ready(function(e){
    17. $('#show').click(function(){
    18. $('#ad').show('easeInQuint');
    19. });
    20. $('#hide').click(function(){
    21. $('#ad').hide(4000);
    22. });
    23. });
    24. </script>
    25. </head>
    26. <body>
    27. <a href="javascript:void(0)" id="show">show</a>
    28. <a href="javascript:void(0)" id="hide">hide</a>
    29. <div id="ad"></div>
    30. </body>
    31. </html>
    同一个按钮点击显示,点击隐藏
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. }
    12. </style>
    13. <script src="js/jquery-1.11.2.min.js"></script>
    14. <script src="js/jquery.easing.1.3.js"></script>
    15. <script>
    16. $(document).ready(function(e){
    17. $('#btn').click(function(){
    18. $('#ad').is(':hidden') ? $('#ad').show('slow') : $('#ad').hide();
    19. });
    20. });
    21. </script>
    22. </head>
    23. <body>
    24. <button id="btn">show-hide</button>
    25. <div id="ad"></div>
    26. </body>
    27. </html>
    同一个按钮点击左边移动三百,再点击回来
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. position:absolute;
    12. }
    13. </style>
    14. <script src="js/jquery-1.11.2.min.js"></script>
    15. <script src="js/jquery.easing.1.3.js"></script>
    16. <script>
    17. $(document).ready(function(e){
    18. $('#btn').click(function(){
    19. //$('#ad').animate({left:300},'slow');
    20. $('#ad').position().left==300 ? $('#ad').animate({left:0},'slow') : $('#ad').animate({left:300},'slow') ;
    21. });
    22. });
    23. </script>
    24. </head>
    25. <body>
    26. <button id="btn">show-hide</button>
    27. <div id="ad"></div>
    28. </body>
    29. </html>
    点左向左移,点右向右移动
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. position:absolute;
    12. }
    13. </style>
    14. <script src="js/jquery-1.11.2.min.js"></script>
    15. <script src="js/jquery.easing.1.3.js"></script>
    16. <script>
    17. $(document).ready(function(e){
    18. $('#btn').click(function(){
    19. if($('#ad').position().left==300){
    20. $('#ad').animate({left:0},'slow');
    21. $(this).html('right');
    22. }else{
    23. $('#ad').animate({left:300},'slow');
    24. $(this).html('left');
    25. }
    26. });
    27. });
    28. </script>
    29. </head>
    30. <body>
    31. <button id="btn">show-hide</button>
    32. <div id="ad"></div>
    33. </body>
    34. </html>
     fadeIn()  == show()
    fadeOut()  ==  hide()
    juqery 控制返回顶部效果
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. position:absolute;
    12. }
    13. .rightad{
    14. width:100px;
    15. height:50px;
    16. background-color:#DF04A7;
    17. position:fixed;
    18. top:500px;
    19. right:0;
    20. display:none;
    21. }
    22. </style>
    23. <script src="js/jquery-1.11.2.min.js"></script>
    24. <script src="js/jquery.easing.1.3.js"></script>
    25. <script>
    26. $(document).ready(function(e){
    27. //控制点击返回顶部
    28. $('.rightad').click(function(){
    29. $('html,body').animate({scrollTop:0},'slow');
    30. });
    31. //控制当滚动到大于300时显示右边返回顶部的方块
    32. $(window).scroll(function(){
    33. if($(this).scrollTop()>300){
    34. $('.rightad').show();
    35. //$('rightad').fadeIn('slow');
    36. }else{
    37. $('.rightad').fadeOut('slow');
    38. }
    39. });
    40. });
    41. </script>
    42. </head>
    43. <body>
    44. <div class="rightad"></div>
    45. <button id="btn">show-hide</button><br>
    46. <div id="ad"></div><br>
    47. <hr>
    48. <button id="btn">show-hide</button><br>
    49. <div id="ad"></div><br>
    50. <hr>
    51. <button id="btn">show-hide</button><br>
    52. <div id="ad"></div><br>
    53. <hr>
    54. <button id="btn">show-hide</button><br>
    55. <div id="ad"></div><br>
    56. <hr>
    57. <button id="btn">show-hide</button><br>
    58. <div id="ad"></div><br>
    59. <hr>
    60. <button id="btn">show-hide</button><br>
    61. <div id="ad"></div><br>
    62. <hr>
    63. <button id="btn">show-hide</button><br>
    64. <div id="ad"></div><br>
    65. <hr><button id="btn">show-hide</button><br>
    66. <div id="ad"></div><br>
    67. <hr>
    68. <button id="btn">show-hide</button><br>
    69. <div id="ad"></div><br>
    70. <hr>
    71. <button id="btn">show-hide</button><br>
    72. <div id="ad"></div><br>
    73. <hr>
    74. <button id="btn">show-hide</button><br>
    75. <div id="ad"></div><br>
    76. <hr>
    77. <button id="btn">show-hide</button><br>
    78. <div id="ad"></div><br>
    79. <hr>
    80. <button id="btn">show-hide</button><br>
    81. <div id="ad"></div><br>
    82. <hr><button id="btn">show-hide</button><br>
    83. <div id="ad"></div><br>
    84. <hr>
    85. <button id="btn">show-hide</button><br>
    86. <div id="ad"></div><br>
    87. <hr>
    88. <button id="btn">show-hide</button><br>
    89. <div id="ad"></div><br>
    90. <hr>
    91. <button id="btn">show-hide</button><br>
    92. <div id="ad"></div><br>
    93. <hr>
    94. <button id="btn">show-hide</button><br>
    95. <div id="ad"></div><br>
    96. <hr>
    97. <button id="btn">show-hide</button><br>
    98. <div id="ad"></div><br>
    99. <hr>
    100. <button id="btn">show-hide</button><br>
    101. <div id="ad"></div><br>
    102. <hr>
    103. <button id="btn">show-hide</button><br>
    104. <div id="ad"></div><br>
    105. <hr>
    106. </body>
    107. </html>
    带动画的右侧固定滚动的效果 一定要用绝对定位
    position:absolute;
    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>无标题文档</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:300px;
    10. background-color:red;
    11. position:absolute;
    12. }
    13. .rightad{
    14. width:200px;
    15. height:50px;
    16. background-color:#DF04A7;
    17. position:absolute;
    18. right:0;
    19. }
    20. </style>
    21. <script src="js/jquery-1.11.2.min.js"></script>
    22. <script src="js/jquery.easing.1.3.js"></script>
    23. <script>
    24. $(document).ready(function(e){
    25. var t=100;//100表示距离顶部的距离
    26. function tt(){
    27. var pos=t + $(window).scrollTop();
    28. $('.rightad').stop().animate({top:pos},1000);
    29. }
    30. tt();
    31. $(window).scroll(tt);
    32. });
    33. </script>
    34. </head>
    35. <body>
    36. <div class="rightad"></div>
    37. <button id="btn">show-hide</button><br>
    38. <div id="ad"></div><br>
    39. <hr>
    40. <button id="btn">show-hide</button><br>
    41. <div id="ad"></div><br>
    42. <hr>
    43. <button id="btn">show-hide</button><br>
    44. <div id="ad"></div><br>
    45. <hr>
    46. <button id="btn">show-hide</button><br>
    47. <div id="ad"></div><br>
    48. <hr>
    49. <button id="btn">show-hide</button><br>
    50. <div id="ad"></div><br>
    51. <hr>
    52. <button id="btn">show-hide</button><br>
    53. <div id="ad"></div><br>
    54. <hr>
    55. <button id="btn">show-hide</button><br>
    56. <div id="ad"></div><br>
    57. <hr><button id="btn">show-hide</button><br>
    58. <div id="ad"></div><br>
    59. <hr>
    60. <button id="btn">show-hide</button><br>
    61. <div id="ad"></div><br>
    62. <hr>
    63. <button id="btn">show-hide</button><br>
    64. <div id="ad"></div><br>
    65. <hr>
    66. <button id="btn">show-hide</button><br>
    67. <div id="ad"></div><br>
    68. <hr>
    69. <button id="btn">show-hide</button><br>
    70. <div id="ad"></div><br>
    71. <hr>
    72. <button id="btn">show-hide</button><br>
    73. <div id="ad"></div><br>
    74. <hr><button id="btn">show-hide</button><br>
    75. <div id="ad"></div><br>
    76. <hr>
    77. <button id="btn">show-hide</button><br>
    78. <div id="ad"></div><br>
    79. <hr>
    80. <button id="btn">show-hide</button><br>
    81. <div id="ad"></div><br>
    82. <hr>
    83. <button id="btn">show-hide</button><br>
    84. <div id="ad"></div><br>
    85. <hr>
    86. <button id="btn">show-hide</button><br>
    87. <div id="ad"></div><br>
    88. <hr>
    89. <button id="btn">show-hide</button><br>
    90. <div id="ad"></div><br>
    91. <hr>
    92. <button id="btn">show-hide</button><br>
    93. <div id="ad"></div><br>
    94. <hr>
    95. <button id="btn">show-hide</button><br>
    96. <div id="ad"></div><br>
    97. <hr>
    98. </body>
    99. </html>

    1. <!doctype html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>webrx-title</title>
    6. <style>
    7. #ad{
    8. width:300px;
    9. height:200px;
    10. background-color:red;
    11. margin:20px;
    12. }
    13. .rightad{
    14. width:200px;
    15. height:150px;
    16. background-color:#E30CC0;
    17. position:absolute;
    18. right:10px;
    19. top:-200px;
    20. }
    21. </style>
    22. <script src="js/jquery-1.11.2.min.js"></script>
    23. <script>
    24. $(document).ready(function(e) {
    25. var t = 200;
    26. function tt(){
    27. var pos = t + $(window).scrollTop();
    28. $('.rightad').stop().animate({top:pos},1000);
    29. }
    30. tt();
    31. $(window).scroll(tt);
    32. });
    33. </script>
    34. </head>
    35. <body>
    36. <div class="rightad"></div>
    37. <button id="btn">show-hide</button><br>
    38. <div id="ad"></div><br>
    39. <h1>hh</h1><br>
    40. <hr>
    41. <button id="btn">show-hide</button><br>
    42. <div id="ad"></div><br>
    43. <h1>hh</h1><br>
    44. <hr>
    45. <button id="btn">show-hide</button><br>
    46. <div id="ad"></div><br>
    47. <h1>hh</h1><br>
    48. <hr>
    49. <button id="btn">show-hide</button><br>
    50. <div id="ad"></div><br>
    51. <h1>hh</h1><br>
    52. <hr>
    53. <button id="btn">show-hide</button><br>
    54. <div id="ad"></div><br>
    55. <h1>hh</h1><br>
    56. <hr>
    57. <button id="btn">show-hide</button><br>
    58. <div id="ad"></div><br>
    59. <h1>hh</h1><br>
    60. <hr>
    61. <button id="btn">show-hide</button><br>
    62. <div id="ad"></div><br>
    63. <h1>hh</h1><br>
    64. <hr>
    65. <button id="btn">show-hide</button><br>
    66. <div id="ad"></div><br>
    67. <h1>hh</h1><br>
    68. <hr>
    69. <button id="btn">show-hide</button><br>
    70. <div id="ad"></div><br>
    71. <h1>hh</h1><br>
    72. <hr>
    73. <button id="btn">show-hide</button><br>
    74. <div id="ad"></div><br>
    75. <h1>hh</h1><br>
    76. <hr>
    77. <button id="btn">show-hide</button><br>
    78. <div id="ad"></div><br>
    79. <h1>hh</h1><br>
    80. <hr>
    81. <button id="btn">show-hide</button><br>
    82. <div id="ad"></div><br>
    83. <h1>hh</h1><br>
    84. <hr>
    85. <button id="btn">show-hide</button><br>
    86. <div id="ad"></div><br>
    87. <h1>hh</h1><br>
    88. <hr>
    89. <button id="btn">show-hide</button><br>
    90. <div id="ad"></div><br>
    91. <h1>hh</h1><br>
    92. <hr>
    93. <button id="btn">show-hide</button><br>
    94. <div id="ad"></div><br>
    95. <h1>hh</h1><br>
    96. <hr>
    97. <button id="btn">show-hide</button><br>
    98. <div id="ad"></div><br>
    99. <h1>hh</h1><br>
    100. <hr>
    101. <button id="btn">show-hide</button><br>
    102. <div id="ad"></div><br>
    103. <h1>hh</h1><br>
    104. <hr>
    105. <button id="btn">show-hide</button><br>
    106. <div id="ad"></div><br>
    107. <h1>hh</h1><br>
    108. <hr>
    109. <button id="btn">show-hide</button><br>
    110. <div id="ad"></div><br>
    111. <h1>hh</h1><br>
    112. <hr>
    113. <button id="btn">show-hide</button><br>
    114. <div id="ad"></div><br>
    115. <h1>hh</h1><br>
    116. <hr>
    117. <button id="btn">show-hide</button><br>
    118. <div id="ad"></div><br>
    119. <h1>hh</h1><br>
    120. <hr>
    121. <button id="btn">show-hide</button><br>
    122. <div id="ad"></div><br>
    123. <h1>hh</h1><br>
    124. <hr>
    125. <button id="btn">show-hide</button><br>
    126. <div id="ad"></div><br>
    127. <h1>hh</h1><br>
    128. <hr>
    129. <button id="btn">show-hide</button><br>
    130. <div id="ad"></div><br>
    131. <h1>hh</h1><br>
    132. <hr>
    133. <button id="btn">show-hide</button><br>
    134. <div id="ad"></div><br>
    135. <h1>hh</h1><br>
    136. <hr>
    137. <button id="btn">show-hide</button><br>
    138. <div id="ad"></div><br>
    139. <h1>hh</h1><br>
    140. <hr>
    141. <button id="btn">show-hide</button><br>
    142. <div id="ad"></div><br>
    143. <h1>hh</h1><br>
    144. <hr>
    145. <button id="btn">show-hide</button><br>
    146. <div id="ad"></div><br>
    147. <h1>hh</h1><br>
    148. <hr>
    149. <button id="btn">show-hide</button><br>
    150. <div id="ad"></div><br>
    151. <h1>hh</h1><br>
    152. <hr>
    153. <button id="btn">show-hide</button><br>
    154. <div id="ad"></div><br>
    155. <h1>hh</h1><br>
    156. <hr>
    157. <button id="btn">show-hide</button><br>
    158. <div id="ad"></div><br>
    159. <h1>hh</h1><br>
    160. <hr>
    161. <button id="btn">show-hide</button><br>
    162. <div id="ad"></div><br>
    163. <h1>hh</h1><br>
    164. <hr>
    165. <button id="btn">show-hide</button><br>
    166. <div id="ad"></div><br>
    167. <h1>hh</h1><br>
    168. <hr>
    169. <button id="btn">show-hide</button><br>
    170. <div id="ad"></div><br>
    171. <h1>hh</h1><br>
    172. <hr>
    173. <button id="btn">show-hide</button><br>
    174. <div id="ad"></div><br>
    175. <h1>hh</h1><br>
    176. <hr>
    177. <button id="btn">show-hide</button><br>
    178. <div id="ad"></div><br>
    179. <h1>hh</h1><br>
    180. <hr>
    181. <button id="btn">show-hide</button><br>
    182. <div id="ad"></div><br>
    183. <h1>hh</h1><br>
    184. <hr>
    185. <button id="btn">show-hide</button><br>
    186. <div id="ad"></div><br>
    187. <h1>hh</h1><br>
    188. <hr>
    189. <button id="btn">show-hide</button><br>
    190. <div id="ad"></div><br>
    191. <h1>hh</h1><br>
    192. <hr>
    193. <button id="btn">show-hide</button><br>
    194. <div id="ad"></div><br>
    195. <h1>hh</h1><br>
    196. <hr>
    197. <button id="btn">show-hide</button><br>
    198. <div id="ad"></div><br>
    199. <h1>hh</h1><br>
    200. <hr>
    201. <button id="btn">show-hide</button><br>
    202. <div id="ad"></div><br>
    203. <h1>hh</h1><br>
    204. <hr>
    205. <button id="btn">show-hide</button><br>
    206. <div id="ad"></div><br>
    207. <h1>hh</h1><br>
    208. <hr>
    209. <button id="btn">show-hide</button><br>
    210. <div id="ad"></div><br>
    211. <h1>hh</h1><br>
    212. <hr>
    213. <button id="btn">show-hide</button><br>
    214. <div id="ad"></div><br>
    215. <h1>hh</h1><br>
    216. <hr>
    217. <button id="btn">show-hide</button><br>
    218. <div id="ad"></div><br>
    219. <h1>hh</h1><br>
    220. <hr>
    221. </body>
    222. </html>








  • 相关阅读:
    (转)GNU风格ARM汇编语法指南(非常详细)5
    (转)ARM GNU常用汇编语言介绍
    RH850 FCL的使用
    RL78 FDL和FSL的使用
    RH850 中断相关
    关于const类型指针变量的使用
    Linux内核中双向链表的经典实现
    RL78 定义常量变量在指定的地址方法
    RL78 RAM GUARD Funtion
    AUTOSAR-Specification of Watchdog Manager 阅读
  • 原文地址:https://www.cnblogs.com/lsr111/p/4584720.html
Copyright © 2011-2022 走看看