如何创建:引用幻灯片

学习如何使用 CSS 和 JavaScript 创建引用幻灯片。

引用幻灯片

一切反动派都是纸老虎!

- 毛泽东

改革是中国发展生产力的必由之路。

- 邓小平

中国共产党人的初心和使命,就是为中国人民谋幸福,为中华民族谋复兴。

- 最高领袖

직접 시도해 보세요

创建引用幻灯片

第一步 - 添加 HTML:


一切反动派都是纸老虎!

- 毛泽东

</div>
改革是中国发展生产力的必由之路。

- 邓小平

</div>
中国共产党人的初心和使命,就是为中国人民谋幸福,为中华民族谋复兴。

- 最高领袖

</div> <a class="next" onclick="plusSlides(1)">❯</a> </div> /* 点/项目符号/指示자 */ <div class="dot-container"> <span class="dot" onclick="currentSlide(1)"></span> <span class="dot" onclick="currentSlide(2)"></span> <span class="dot" onclick="currentSlide(3)"></span> </div>

두 번째 단계 - CSS 추가:

스ライ드, 버튼, 원점 등의 스타일 설정:

/* 슬라이드 컨테이너 */
.slideshow-container {
  position: relative;
  background: #f1f1f1f1;
}
/* 슬라이드 */
.mySlides {
  display: none;
  padding: 80px;
  text-align: center;
}
/* 다음 & 이전 버튼 */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -30px;
  padding: 16px;
  color: #888;
  font-weight: bold;
  font-size: 20px;
  border-radius: 0 3px 3px 0;
  user-select: none;
}
/* 다음 버튼을 오른쪽에 정위치 */
.next {
  position: absolute;
  right: 0;
  border-radius: 3px 0 0 3px;
}
/* 마우스��류시, 조금 불투명한 검은 배경색 추가 */
.prev:hover, .next:hover {
  background-color: rgba(0,0,0,0.8);
  color: white;
}
/* 点/项目符号/指示자 컨테이너 */
.dot-container {
  text-align: center;
  padding: 20px;
  background: #ddd;
}
/* 点/项目符号/指示器 */
.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;
}
/* 모든 인용에 이탈릭 스타일 추가 */
q {font-style: italic;}
/* 저자에 파스쿠아 블루 색상 추가 */
.author {color: cornflowerblue;}

세 번째 단계 - JavaScript 추가하기:

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";
}

직접 시도해 보세요

관련 페이지

교육:이미지 슬라이드를 어떻게 생성하나요?

교육:라이트박스를 어떻게 생성하나요?