123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Swiper demo</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
- <!-- Link Swiper's CSS -->
- <link rel="stylesheet" href="./dist/css/swiper.min.css">
- <!-- Demo styles -->
- <style>
- html,
- body {
- position: relative;
- height: 100%;
- }
-
- body {
- background: #fff;
- font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
- font-size: 14px;
- color: #000;
- margin: 0;
- padding: 0;
- }
-
- .swiper-container {
- width: 300px;
- height: 300px;
- position: absolute;
- left: 50%;
- top: 50%;
- margin-left: -150px;
- margin-top: -150px;
- }
-
- .swiper-slide {
- background-position: center;
- background-size: cover;
- }
-
- .logo {
- display: flex;
- justify-content: start;
- background: #589fc3;
- height: 2rem;
- align-items: center;
- }
-
- .sName {
- color: #fff;
- font-size: 16px;
- margin-left: 10px;
- }
-
- .logoImg>img {
- width: 100%;
- height: 100%;
- }
-
- .logoImg {
- width: 1.5rem;
- height: 1.5rem;
- margin: auto 0 auto 1rem;
- }
-
- .swiper-pagination {
- bottom: -1rem !important;
- }
-
- .bg {
- width: 100%;
- height: 100%;
- background: url(./img/star.png) no-repeat center 100%;
- background-size: cover;
- }
-
- @media only screen and (max-width: 500px) {
- .swiper-container {
- height: 32rem;
- top: 30%;
- }
- .swiper-slide {
- height: 32rem;
- }
- .swiper-pagination {
- bottom: -2rem !important;
- }
- }
- </style>
- </head>
- <body>
- <div class="bg">
- <div class="logo">
- <div class="logoImg"><img src="./img/logo.png" alt=""></div>
- <div class="sName">深圳市民治中学</div>
- </div>
- <!-- Swiper -->
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide" style="background-image:url(img/first.png)"></div>
- <div class="swiper-slide" style="background-image:url(img/second.png)"></div>
- <div class="swiper-slide" style="background-image:url(img/third.png)"></div>
- <div class="swiper-slide" style="background-image:url(img/fourth.png)"></div>
- <div class="swiper-slide" style="background-image:url(img/fiveth.png)"></div>
- </div>
- <!-- Add Pagination -->
- <div class="swiper-pagination"></div>
- </div>
- </div>
- <!-- Swiper JS -->
- <script src="./dist/js/swiper.min.js"></script>
- <!-- Initialize Swiper -->
- <script>
- var swiper = new Swiper('.swiper-container', {
- pagination: '.swiper-pagination',
- effect: 'cube',
- grabCursor: true,
- cube: {
- shadow: true,
- slideShadows: true,
- shadowOffset: 20,
- shadowScale: 0.94
- }
- });
- let htmlwidth = document.documentElement.clientWidth || document.body.clientWidth
- let htmlDom = document.getElementsByTagName('html')[0];
- if (htmlwidth > 750) {
- htmlwidth = 750
- }
- htmlDom.style.fontSize = htmlwidth / 20 + 'px';
- window.onresize = function() {
- let htmlwidth = document.documentElement.clientWidth || document.body.clientWidth
- let htmlDom = document.getElementsByTagName('html')[0];
- if (htmlwidth > 750) {
- htmlwidth = 750
- }
- htmlDom.style.fontSize = htmlwidth / 20 + 'px';
- };
- </script>
- </body>
- </html>
|