国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

jquery簡單實現圖片切換效果的方法

2024-05-06 16:19:59
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了jquery簡單實現圖片切換效果的方法,涉及jQuery鏈式操作及圖片操作的相關技巧,需要的朋友可以參考下

本文實例講述了jquery簡單實現圖片切換效果的方法。分享給大家供大家參考。具體實現方法如下:

 

 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
  3. <html xmlns="http://www.w3.org/1999/xhtml"
  4. <head> 
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  6. <title>無標題文檔</title> 
  7. <style type="text/css"
  8. #slider{ 
  9. position:relative; 
  10. overflow:hidden; 
  11. margin:20px auto; 
  12. height:240px; 
  13. width:740px; 
  14. padding:5px; 
  15. border:2px solid #cdcdcd; 
  16. #show{ 
  17. position:relative; 
  18. height:240px;  
  19. width:740px; 
  20. #show .img{ 
  21. width:740px; 
  22. height:240px; 
  23. margin-bottom:5px; 
  24. #num{ 
  25. position:absolute; 
  26. right:5px; 
  27. top:220px; 
  28. #num span{ 
  29. float:left; 
  30. display:block; 
  31. text-align:center; 
  32. width:20px; 
  33. height:20px; 
  34. line-height:20px; 
  35. margin:2px; 
  36. font-family:Arial, Helvetica, sans-serif; 
  37. font-size:14px; 
  38. font-weight:blod; 
  39. background:#f2f2f2; 
  40. border:1px solid #D78918; 
  41. color:#D78918; 
  42. #num .current{ 
  43. color: #fff; 
  44. width:21px; 
  45. height:21px; 
  46. line-height:21px; 
  47. font-size: 16px; 
  48. border:0px; 
  49. margin:0px 1px; 
  50. background-color: #FF7300; 
  51. </style> 
  52. <script src="js/jquery-1.3.1.js" type="text/javascript"></script> 
  53. <script type="text/javascript"
  54. <!-- 
  55. $(function(){ 
  56. var count=1; 
  57. setInterval(function(){ 
  58. count=count==5?0:count; 
  59. var top=-count*(240+5); 
  60. count++; 
  61. $("#show").animate({top:top},600); 
  62. $("#num").find("span").eq(count-1).addClass("current").siblings().removeClass("current"); 
  63. },2000); 
  64. }) 
  65. --> 
  66. </script> 
  67. </head> 
  68. <body> 
  69. <div id="slider"
  70. <div id="show"
  71. <div class="img" style="background:red;"></div> 
  72. <div class="img" style="background:blue"></div> 
  73. <div class="img" style="background:gold"></div> 
  74. <div class="img" style="background:yellow"></div> 
  75. <div class="img" style="background:green"></div> 
  76. </div> 
  77. <div id="num"
  78. <span class="current">1</span> 
  79. <span>2</span> 
  80. <span>3</span> 
  81. <span>4</span> 
  82. <span>5</span> 
  83. </div> 
  84. </div> 
  85. </body> 
  86. </html> 

希望本文所述對大家的jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 鄢陵县| 兴安县| 江阴市| 深水埗区| 百色市| 黄冈市| 门头沟区| 奉节县| 澄城县| 博兴县| 阿合奇县| 旌德县| 扶风县| 南汇区| 株洲县| 三穗县| 巴中市| 永昌县| 桐城市| 泰兴市| 陵川县| 子洲县| 南乐县| 大同市| 佛学| 古田县| 类乌齐县| 龙山县| 中西区| 定兴县| 灵璧县| 通山县| 景德镇市| 仁化县| 武隆县| 会昌县| 托克逊县| 宝丰县| 新巴尔虎右旗| 米泉市| 阳新县|