<!DOCTYPE html>
<html>
<head>
<title>W3.CSS(w3cschool.cn)</title>
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
<link rel="stylesheet" href="https://7npmedia.w3cschool.cn/w3.css">
<style>
.mySlides {display:none;}
</style>
</head>
<body>
<div class="w3-container">
<h2>动画幻灯片</h2>
<p>使用w3-animate- *类从屏幕的顶部,底部,左侧或右侧滑动或淡入一个元素。</p>
</div>
<div class="w3-content w3-section" style="max-width:500px">
<img class="mySlides w3-animate-top" src="https://atts.w3cschool.cn/img_rr_01.jpg" style="width:100%">
<img class="mySlides w3-animate-bottom" src="https://atts.w3cschool.cn/img_rr_02.jpg" style="width:100%">
<img class="mySlides w3-animate-top" src="https://atts.w3cschool.cn/img_rr_03.jpg" style="width:100%">
<img class="mySlides w3-animate-bottom" src="https://atts.w3cschool.cn/img_rr_04.jpg" style="width:100%">
</div>
<script>
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;