* { margin:0; padding:0; } li { list-style:none; } .all { width:900px; height:500px; padding:7px; border:1px solid #ccc; margin:50px auto 0; } /*这三个最重要*/ .screen { width:900px; height:500px; overflow:hidden; position:relative; } .screen img { width:900px; height:500px; float:left; } .screen .ul { position:absolute; left:0; } .all ol { position:absolute; right:10px; bottom:10px; line-height:20px; text-align:center; } .all ol li { float:left; width:20px; height:20px; border:1px solid #ccc; background-color:#fff; margin-left:10px; cursor:pointer; } .all ol li.active { background-color:orange; color:#fff; } .arr span { width:40px; height:40px; background-color:rgba(0,0,0,.3); position:absolute; top:50%; margin-top:-20px; cursor:pointer; line-height:40px; text-align:center; font-weight:bold; font-family:"黑体"; font-size:30px; color:#fff; border:1px solid #fff; left:5px; transition:all .3s; opacity:.5; } .arr .right { right:5px; left:auto; } .arr span:hover { background-color:rgba(0,0,0,.5); opacity:1; }
更新时间:2021-01-13 00:19:28
around({ //调用 ulcss: ".ul", //必填:长滚轮css butscss: "ol li", //选填:小点css acticlass: "active", //选填:高亮小点class buton: "mouseenter", //选填:小点翻页的事件 click/mouseenter(默认) wilecss: ".left", //选填:左翻页按钮css wiricss: ".right" //选填:右翻页按钮css },4000 /*选填:轮播频率,默认值3000*/ );
html结构:相对定位 宽高 超出隐藏
<div class="screen"> <div class="ul"> <img src="https://www.jq22.com/img/cs/500x300-1.png" alt=""> <img src="https://www.jq22.com/img/cs/500x300-2.png" alt=""> <img src="https://www.jq22.com/img/cs/500x300-3.png" alt=""> <img src="https://www.jq22.com/img/cs/500x300-4.png" alt=""> <img src="https://www.jq22.com/img/cs/500x300-5.png" alt=""> </div> </div>
css样式: 大概这样
.screen { width: 900 px;height: 500 px;overflow: hidden;position: relative; }.screen img { width: 900 px;height: 500 px;float: left; }.screen.ul { position: absolute;left: 0; }