通過 w3 學校,我能夠制作此幻燈片并添加它并使其在我的網頁上運行。除了按鈕的位置外,一切都運行順利。目前它們在自己的 div 中,但我希望它們位于底部中心的圖像頂部。到目前為止,我已經嘗試刪除 div 并調整位置,但這對我不起作用。下面是代碼,這里是一個Codepen。實際的幻燈片在示例中可能不起作用(現在只是在輸入代碼段時發(fā)現這一點),但我只是在尋找如何定位<span class="dot"圖像頂部的 3 個點提前致謝!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";}/* SLIDESHOW */#slideshow { height: 400px; width: 100%; position: relative; margin: auto; overflow: hidden;}#slideshow img { height: 400px; width: 100%;}/* Next & previous buttons */.prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.4s ease; border-radius: 0 3px 3px 0; user-select: none;}/* Position the "next button" to the right */.next { right: 0; border-radius: 3px 0 0 3px;}/* On hover, add a black background color with a little bit see-through */.prev:hover, .next:hover { background-color: rgba(0,0,0,0.8);}/* The dots/bullets/indicators */.dot { cursor: pointer; height: 15px; width: 15px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease;}.active, .dot:hover { background-color: #717171;}.fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s;}
如何將幻燈片選擇器點放在圖像頂部?
拉丁的傳說
2021-12-12 09:58:17