打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
七行jquery代码实现图片渐变切换【兼容ie6、 Chrome、 Firefox】
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5. <meta name="author" content="Nancle from CAU CS101" />  
  6. <title>jQuery图片渐变切换</title>  
  7. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>  
  8. <style type="text/css">  
  9. ul{position:relative;}  
  10. ul li{display:block; position:absolute; left:0; top:0}  
  11. img{width:480px; height:320px; border:5px solid #ccc}  
  12. </style>  
  13. </head>  
  14. <body>  
  15. <ul>  
  16.     <li><img src="http://down.fpwap.com/UploadFiles/sjbz/2010/6/2010615222757.jpg" /></li>  
  17.     <li><img src="http://img5.cache.netease.com/m/app/201108/31/953DDLJL.jpg" /></li>  
  18.     <li><img src="http://i-imgp.fetionpic.com/fphoto/photo1/M00/41/83/rBUyIVHfdvC9LAM6AAC873sDEoo981.jpg" /></li>  
  19.     <li><img src="http://img.bimg.126.net/photo/L0py2I9-0qIAd_Keov5GhQ==/1710804908448128265.jpg" /></li>  
  20. </ul>  
  21. </div>  
  22. <script>  
  23. var switchSpeed = 1000;         //图片切换时间  
  24. var fadeSpeed = 1500;           //渐变时间  
  25. setInterval(function(){  
  26.     $('img').last().fadeOut(fadeSpeed, function(){  
  27.         $(this).show().parent().prependTo($('ul'));  
  28.     });  
  29. }, switchSpeed);  
  30. </script>  
  31. </body>  
  32. </html>  


效果预览:http://quchen.cau.edu.cn/jsDev/gradien.html

本文出自:http://blog.csdn.net/nancle/article/details/9706023

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
jQuery标签TAB控制图片切换代码
图片无缝滚动-jquery插件
JS+CSS打造的交错式图片幻灯切换效果
JQUERY 获取当前焦点对象属性,
原生js实现图片切换
关于图片导航的优化处理
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服