我正在尝试循环一些引号,以便它们继续反复显示,但是我遇到了麻烦,我在google和此处查看了其他一些帖子,但无法解决如何将这些帖子中的代码更改为下面提供我的代码。我使用了一个名为edit fiddle-JSFiddle的网站来测试代码,目前它仅在最后一个报价处停止。任何帮助,将不胜感激,谢谢。var slideIndex = 0;showSlides();function showSlides() { var i; var slides = document.getElementsByClassName("mySlides"); var dots = document.getElementsByClassName("dot"); for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slideIndex++; if (slideIndex > slides.length) { slideIndex = 1 } 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"; setTimeout(showSlides, 8000); // Change image every 10 seconds}* { box-sizing: border-box}body { font-family: Verdana, sans-serif; margin: 0}/* Slideshow container */.slideshow-container { position: relative;}/* Slides */.mySlides { display: none; padding: 80px; text-align: center;}/* Add an italic font style to all quotes */q { font-style: italic;}/* Add a blue color to the author */.author { color: cornflowerblue;}<!DOCTYPE html><html><head> <meta name="viewport" content="width=device-width, initial-scale=1"></head><body> <div class="slideshow-container"> <div class="mySlides"> <q>I HATE EVERY MINUTE OF TRAINING. BUT I SAID, DON’T QUIT. SUFFER NOW AND LIVE THE REST OF YOUR LIFE AS A CHAMPION.</q> <p class="author">- MOHAMMAD ALI</p> </div> <div class="mySlides"> <q>YOU’RE THE ONLY ONE WHO CAN MAKE THE DIFFERENCE. WHATEVER YOUR DREAM IS, GO FOR IT. </q> <p class="author">– MAGIC JOHNSON.</p> </div> <div class="mySlides"> <q>IF YOU TURN UP WORRYING ABOUT HOW YOU’RE GOING TO PERFORM, YOU’VE ALREADY LOST. TRAIN HARD, TURN UP, RUN YOUR BEST AND THE REST WILL TAKE CARE OF ITSELF. </q> <p class="author">– USAIN BOLT.</p> </div>
添加回答
举报
0/150
提交
取消