首页 > 网站 > WEB开发 > 正文

原生javascript焦点轮播图

2024-04-27 14:16:35
字体:
来源:转载
供稿:网友

原生javascript焦点轮播图

刚刚学会,写了一个轮播图效果,不过bug蛮多,请高手指点一下,谢谢
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>电影轮播图</title>
  6. <style type="text/CSS">
  7. *{margin:0;padding: 0;list-style: none;}
  8. body{}
  9. #container{width:1000px;height:409px;position:relative;margin:20px auto;overflow: hidden;}
  10. #list{width:5000px;height:409px;position:absolute;z-index: 1}
  11. #list img{float:left;display: block;}
  12. #PRe{background-image:urlhttp://www.w3cfuns.com/data/attachment/album/201411/17/153459b7h8s70shfr2hwrd.png);width:45px;height:45px;float:left;position:absolute;top:190px;left:10px;cursor:pointer;display:none;z-index: 2;}
  13. #next{background-image: url(http://www.w3cfuns.com/data/attachment/album/201411/17/153459g52888zwz1wa11tm.png);width:45px;height:45px;float: left;position:absolute;top:190px;right:10px;cursor:pointer;display:none;z-index: 2;}
  14. #container:hover #pre,#container:hover #next{display: block;}
  15. #pre:hover,#next:hover{background-color: rgba(0,0,0,0.7); }
  16. #dot{width:1000px;height:10px;position:absolute;bottom:15px;left:450px;z-index: 10;}
  17. #dot span{width:10px;height:10px;display:block;border-radius:10px;background-color: #fff;margin:0 5px;float: left;cursor:pointer;}
  18. #dot .on{background-color: #69aaec;}
  19. </style>
  20. <script type="text/Javascript">
  21. window.onload = function(){
  22. var container = document.getElementById('container');//定义container,获取container id;
  23. var list = document.getElementById('list');//定义list,获取list id;
  24. var dot = document.getElementById('dot').getElementsByTagName('span');//定义dot ,获取dot id;
  25. Word-wrap: break-word; margin: 0px; padding: 0px 0px 0px 10px; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; list-style-type: decimal-leading-ze
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表