美女题材的壁纸 第一期(1920*1080)
<div id="dz_carousel" style="width:100%;height:600px;overflow:hidden;position:relative;margin:10px auto;border:1px solid #ddd;background:#000;"><div id="dz_car_inner" style="width:100%;height:100%;position:relative;">
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01ac3ed3ca6b12c5f1.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01ab4563eb0e254eee.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01ab90904476fdb80a.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01abb52d913728b25b.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01b3c649a0d76479d0.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01b31984b46b7125a5.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
<div class="dz_slide" style="width:100%;height:100%;position:absolute;top:0;left:0;display:none;align-items:center;justify-content:center;">
<img src="https://hefollo.com/%E7%94%B5%E8%84%91%E7%AB%AF-%E7%BE%8E%E5%A5%B3%E5%9B%BE%E7%89%87/t01bfcf40187f8ee599.jpg" alt="" style="max-width:100%;max-height:100%;" />
</div>
</div>
<button type="button" id="dz_prev" style="position:absolute;top:50%;left:10px;transform:translateY(-50%);width:40px;height:40px;background:rgba(0,0,0,0.5);color:#fff;border:none;border-radius:50%;font-size:22px;cursor:pointer;z-index:10;">‹</button>
<button type="button" id="dz_next" style="position:absolute;top:50%;right:10px;transform:translateY(-50%);width:40px;height:40px;background:rgba(0,0,0,0.5);color:#fff;border:none;border-radius:50%;font-size:22px;cursor:pointer;z-index:10;">›</button>
<div id="dz_dots" style="position:absolute;bottom:12px;left:0;right:0;text-align:center;z-index:10;"></div>
</div>
<script type="text/javascript">
(function(){
var box = document.getElementById('dz_carousel');
if(!box) return;
var slides = box.getElementsByClassName('dz_slide');
var dotsBox = document.getElementById('dz_dots');
var prevBtn = document.getElementById('dz_prev');
var nextBtn = document.getElementById('dz_next');
var curIdx = 0;
var timer = null;
var total = slides.length;
// 生成圆点
for(var i=0;i<total;i++){
var dot = document.createElement('span');
dot.style.cssText = 'display:inline-block;width:10px;height:10px;margin:0 4px;background:rgba(255,255,255,0.6);border-radius:50%;cursor:pointer;';
dot.setAttribute('data-idx', i);
dotsBox.appendChild(dot);
}
var dots = dotsBox.getElementsByTagName('span');
function show(idx){
if(idx<0) idx = total-1;
if(idx>=total) idx = 0;
curIdx = idx;
for(var i=0;i<total;i++){
slides.style.display = 'none';
dots.style.background = 'rgba(255,255,255,0.6)';
}
slides.style.display = 'flex';
dots.style.background = '#fff';
}
function nextSlide(){ show(curIdx+1); }
function prevSlide(){ show(curIdx-1); }
function startAuto(){ timer = setInterval(nextSlide, 3000); }
function stopAuto(){ clearInterval(timer); }
prevBtn.onclick = function(){ stopAuto(); prevSlide(); startAuto(); };
nextBtn.onclick = function(){ stopAuto(); nextSlide(); startAuto(); };
for(var j=0;j<dots.length;j++){
dots.onclick = (function(k){
return function(){ stopAuto(); show(k); startAuto(); };
})(j);
}
box.onmouseenter = stopAuto;
box.onmouseleave = startAuto;
show(0);
startAuto();
})();
</script>
页:
[1]