Home >Web Front-end >JS Tutorial >Native js implements mobile development carousel pictures and album sliding effects_javascript skills
How to use:
Quote css files and js files respectively, such as:
<link rel="stylesheet" type="text/css" href="css/photoSlider.min.css" /> <script src="js/photoSlider.min.js" type="text/javascript" charset="utf-8"></script>
html:
<li><a href="/"><img src="img/1.jpg" /></a></li> <li><a href="/"><img src="img/2.jpg" /></a></li> <li><a href="/"><img src="img/3.jpg" /></a></li>
javascript:
window.onload=function(){ photoSlide({ wrap: document.getElementById('photo'),//最外层容器 loop: true,//设置无缝循环 autoPlay:true,//自动轮播 autoTime:4000,//轮播时间间隔 pagination:true //点状态列表 }); }
Full example:
photoSlider-纯js移动开发轮播图、相册滑动插件 <li><a href="/"><img src="img/1.jpg" /></a></li> <li><a href="/"><img src="img/2.jpg" /></a></li> <li><a href="/"><img src="img/3.jpg" /></a></li>
The above is the entire content of this article, I hope you all like it.