我正在寻找一些关于我创建的图像滑块的建议/支持。它由两部分组成,左侧滑动的图像和右侧的标题和导航。我面临的问题是我无法从幻灯片的容器中取出标题,我想知道是否有办法将标题排除在外,并且当幻灯片发生变化时仍然可以使用幻灯片。
另一个问题是大屏幕上的响应能力很糟糕,我只是需要一些建议。这是我创造的小提琴及其复制品。
https://jsfiddle.net/df2psx6q/
这是JQuery:
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
HTML:
<section class="slider-content" style="position: relative;">
<div class="box-slider right-skew-slider"></div>
<div class="slideshow-container">
<div class="mySlides fade">
<div class="numbertext">1 / 3</div>
<img src="<?php bloginfo('template_url'); ?>/assets/img/ink-cloud.jpg" alt="Digital Icon">
</div>
<div class="mySlides fade">
<div class="numbertext">2 / 3</div>
<img src="<?php bloginfo('template_url'); ?>/assets/img/ink-cloud.jpg" alt="Digital Icon">
</div>
<div class="mySlides fade">
<div class="numbertext">3 / 3</div>
<img src="<?php bloginfo('template_url'); ?>/assets/img/ink-cloud.jpg" alt="Digital Icon">
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<br>
<div style="text-align:center" class="controls">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
</div>
</section>