\
\
<! DOCTYPEhtml>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="Width =width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Swiper demo</title>
<! -- Link Swiper's CSS -->
<link href="https://cdn.bootcss.com/Swiper/4.3.0/css/swiper.min.css" rel="stylesheet">
<! -- Demo styles -->
<style>
html.body {
position: relative;
width: 100%;
height: 100%;
}
body {
margin: 0;
padding: 0;
}
.m-swiper-container{width: 100%; }.m-swiper-slide{display: block; background-size: 100% 100%; }.m-swiper-img{width: 100%; }</style>
</head>
<body>
<! -- Swiper -->
<div class="swiper-container m-swiper-container" id="m-swiper-container">
<div class="swiper-wrapper" id="m-swiper-wrapper">
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<! -- Swiper JS -->
<script src="https://cdn.bootcss.com/Swiper/4.3.0/js/swiper.min.js"></script>
<! -- Initialize Swiper -->
<script>
var swiperWrapper = $('#m-swiper-wrapper');
var json = [{
img:'https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4c1062edda0e4ad9b5cbbcf4241c11a4~tplv-k3u1fbpfcp-zoom-1.image'.url:'http://www.baidu.com'
},
{
img:'https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7ee1bdb9b6794f47a33ffc8a4fd2e9c0~tplv-k3u1fbpfcp-zoom-1.image'.url:'http://www.baidu.com'
},
{
img:'https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/27d6d089103f4cb78d0f85220549358a~tplv-k3u1fbpfcp-zoom-1.image'.url:'http://www.baidu.com'
}];
var html = ' ';
for (var i = 0; i < json.length; i++) {
html += '<a class="swiper-slide m-swiper-slide" href="' + json[i].url + '" >' +
'<img src="' + json[i].img + '" class="m-swiper-img">' +
'</a>';
}
swiperWrapper.html(html);
var swiper = new Swiper('#m-swiper-container', {
speed:300.autoplay : {
delay:3000
},
loop: true
});
</script>
</body>
</html>
Copy the code
\
\
\
\
\
\
\
Note: Welcome to join the QQ group of web front-end job hunting and recruitment: 668352707
支那
支那
\