效果如下:
代码如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>javascript</title> <style> *{margin:0;padding:0;border:0;} a{text-decoration:none;color:#fff;font-size:40px;line-height:200px;display:none;text-align:center;} #container{width:300px;height:200px;margin:50px auto;position:relative;overflow:hidden;} #list{width:2100px;height:200px;position:absolute;top:0;} #list span{width:300px;height:200px;display:inline-block;text-align:center;font-size:22px;float:left;color:#fff;} .one{background:red;} .two{background:orange;} .three{background:blue;} .four{background:green;} .five{background:black;} #buttons{width:200px;height:30px;position:absolute;bottom:0px;left:100px;z-index:9;} #buttons span{display:inline-block;cursor:pointer;width:12px;height:12px;border-radius:6px;background: #2a2a2a} #prev{width:40px;height:200px;position:absolute;left:0px;} #next{width:40px;height:200px;position:absolute;right:0px;} #container .on{background:#fff;} </style> </head> <body> <div id="container"> <div id="list" style="left:-300px"> <span class="five">我是黑色第五张</span> <span class="one">我是红色第一张</span> <span class="two">我是黄色第二张</span> <span class="three">我是蓝色第三张</span> <span class="four">我是绿色第四张</span> <span class="five">我是黑色第五张</span> <span class="one">我是红色第一张</span> </div> <div id="buttons"> <span class="on" index="1"></span> <span index="2"></span> <span index="3"></span> <span index="4"></span> <span index="5"></span> </div> <a id="prev" href="javascript:;" rel="external nofollow" rel="external nofollow" ><</a> <a id="next" href="javascript:;" rel="external nofollow" rel="external nofollow" >></a> </div> <script> var container = document.getElementById('container'), list = document.getElementById('list'), buttons = document.getElementById('buttons').getElementsByTagName('span'), prev = document.getElementById('prev'), next = document.getElementById('next'), index = 1, len = 5, interval = 3000, animated = false, timer; function animate(offset){ if(offset == 0) return; animated = true; var time = 150, inter = 5, speed = offset/(time/inter), left = parseInt(list.style.left) + offset; var go = function(){ if((speed>0 && parseInt(list.style.left)<left) || (speed<0 && parseInt(list.style.left)>left)){ list.style.left = parseInt(list.style.left) + speed + 'px'; setTimeout(go,inter); }else{ list.style.left = left + 'px'; if(left > -100){ list.style.left = -300*len + 'px'; } if(left < (-300*len)){ list.style.left = '-300px' } animated = false; } } go(); } function showButton(){ for(var i=0 ; i<buttons.length ; i++){ if(buttons[i].className == 'on'){ buttons[i].className = ''; break; } } buttons[index - 1].className = 'on'; } function play(){ timer = setTimeout(function(){ next.onclick(); play(); },interval); } function stop(){ clearTimeout(timer); } next.onclick = function(){ if(animated) { return; } if(index == 5){ index = 1; }else{ index++; } animate(-300); showButton(); } prev.onclick = function(){ if(animated) { return; } if(index == 1){ index = 5; }else{ index--; } animate(300); showButton(); } for (var i = 0; i < buttons.length; i++) { buttons[i].onclick = function () { if (animated) { return; } if(this.className == 'on') { return; } var myIndex = parseInt(this.getAttribute('index')); var offset = -300 * (myIndex - index); animate(offset); index = myIndex; showButton(); } } container.onmouseover = function(){ prev.style.display = next.style.display = 'block'; stop(); } container.onmouseout = function(){ prev.style.display = next.style.display = 'none'; play(); } play(); </script> </body> </html>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年09月24日
2024年09月24日
- 群星《左耳·听见爱情》星文唱片[WAV+CUE]
- 陈美玲.1987-孤单的心【EMI百代】【WAV+CUE】
- 黄乙玲.2005-甲你作伴【亚律音乐】【WAV+CUE】
- 张雨生.1997-口是心非【丰华】【WAV+CUE】
- 群星《右耳·聆听私语》星文唱片[WAV+CUE]
- VitoCadonau-ramur-encasaveglia(2024)[24-44,1]FLAC
- Mozart--ArthurGrumiaux(2024)[24BT]WAV
- 国风大师纯音系列《付娜广粤古筝》1CD[MP3][364.4MB]
- 国风大师纯音系列《罗晶-古筝情缘》1CD[MP3][75.1MB]
- 国风大师纯音系列《民乐琴王童丽-与古筝的约会》1CD[MP3][166.4MB]
- 刘美君.1993-被你纵坏【SONY】【WAV+CUE】
- 黄鹤翔.1998-爱的咏叹调【中唱】【WAV+CUE】
- 薰妮.1983-梦+淡(2000年永恒真存双碟版)【永恒】【WAV+CUE】
- 方伊琪.1976-时光消逝(2015复黑限量版)【风行】【WAV+CUE】
- 群星.1990-宝丽金影视金曲巡礼【宝丽金】【WAV+CUE】