效果图:
代码如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> *{ margin:0; padding:0; border:none; } li{ list-style: none; } #box{ height:340px; width:790px; position: relative; margin:100px auto; } #box #list1{ height:340px; width:790px; } #box #list1 li{ font-size: 80px; line-height: 340px; text-align: center; height:340px; width:790px; position: absolute; left:0; top:0; opacity: 0; filter: alpha(opacity=0); } #box #list1 li img{ height:340px; width:790px; } #shang,#xia{ height:80px; width:50px; color:#212121; background: #ccc; font-size: 60px; font-weight: bold; line-height: 80px; text-align: center; position: absolute; top:130px; opacity: 0.8; filter: alpha(opacity=80); cursor: pointer; } #shang{ left:0; } #xia{ right:0; } #box #list2{ height:20px; width:195px; position: absolute; left:297px; bottom:25px; opacity: 0.8; filter: alpha(opacity=80); } #box #list2 li{ height:20px; width:20px; background: #ccc; border-radius: 50%; float: left; margin-right:5px; cursor: pointer; } #box #list2 li.active{ background: black; } </style> <script type="text/javascript"> onload = function(){ var oBox = document.getElementById('box'); var oLIst1 = document.getElementById('list1'); var aLi1 = oLIst1.getElementsByTagName('li'); var oLIst2 = document.getElementById('list2'); var aLi2 = oLIst2.getElementsByTagName('li'); var oShang = document.getElementById('shang'); var oXia = document.getElementById('xia'); aLi1[0].style.opacity = 1; aLi1[0].style.filter = 'alpha(opacity=100)'; var size = aLi1.length; var i = 0; var timer = setInterval(function(){ i ++; move(); },2000); function move(){ if(i >= size){ i = 0 } if(i < 0){ i = size-1; } for(var j = 0; j < aLi1.length; j ++){ if(j == i){ animate(aLi1[j],{opacity:100}); aLi2[j].className = 'active'; }else{ animate(aLi1[j],{opacity:0}); aLi2[j].className = ''; } } } //前一张 oShang.onclick = function(e){ var evt = e || event; evt.preventDefault(); i --; move(); } //后一张 oXia.onclick = function(e){ var evt = e || event; evt.preventDefault(); i ++; move(); } //下面的圆点 for(var k = 0;k < aLi2.length; k ++){ aLi2[k].index = k; aLi2[k].onmouseenter = function(){ i = this.index; move(); } } oBox.onmouseenter = function(){ clearInterval(timer); } oBox.onmouseleave = function(){ timer = setInterval(function(){ i ++; move(); },2000); } /*************************缓冲运动 可封装留着以后备用^_^*************************/ function getStyleAttr(obj, attr){ if (window.getComputedStyle){ return getComputedStyle(obj, null)[attr]; } else { return obj.currentStyle[attr]; } } function animate(obj, json, fn){ clearInterval(obj.timer); obj.timer = setInterval(function(){ var bStop = true; for (var attr in json){ var iTarget = json[attr]; var current; if (attr == "opacity"){ current = parseFloat(getStyleAttr(obj, attr))*100; current = Math.round(current); } else { current = parseFloat(getStyleAttr(obj, attr)); current = Math.round(current); } var speed = (iTarget-current)/8; (400-393)/8 speed = speed>0 "opacity"){ obj.style[attr] = (current+speed)/100; obj.style.filter = "alpha(opacity=" + (current+speed) + ")"; } else { obj.style[attr] = current+speed + "px"; } } if (bStop){ console.log("停止运动"); clearInterval(obj.timer); if (fn) { fn(); } } }, 30); } } </script> </head> <body> <div id="box"> <ul id="list1"> <li style="background: red;">1</li> <li style="background: yellow;">2</li> <li style="background: green;">3</li> <li style="background: blue;">4</li> <li style="background: blueviolet;">5</li> <li style="background: brown;">6</li> <li style="background: orangered;">7</li> <li style="background: palevioletred;">8</li> </ul> <ul id="list2"> <li class="active"></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li style="margin-right:0px;"></li> </ul> <div id="shang"> < </div> <div id="xia"> > </div> </div> </body> </html>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“js轮播图透明度切换(带上下页和底部圆点切换)”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
2025年03月01日
2025年03月01日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]