The role of Swipe.js:
This is a lightweight mobile sliding component that supports touch mobility and supports responsive pages.
:
Code:
1<! DOCTYPE html>234<meta charset= "UTF-8" >5<title>Title</title>6<style>7*{8padding:0;9margin:0;Ten } One . Swipe { A Overflow:hidden; - position:relative; - width:800px; the } -. swipe-Wrap { - Overflow:hidden; - position:relative; +list-Style:none; - } +. swipe-wrap >Li { A float: Left; atwidth:100%; - position:relative; - } -. swipe-wrap > Li >a{ -width:100%; - Display:block; in } -. swipe-wrap > li > A >img{ towidth:100%; + Display:block; - } the</style> *<script src= "./js/swipe.js" ></script> $Panax Notoginseng<body> -<!--swipe need a structure like this, not a label like the one below, which means that the label name can be arbitrary-- the<div id= ' slider ' class= ' swipe ' > +<ul class= ' Swipe-wrap ' > A<li> the<a href= "javascript:;" class= "wrap" > + -</a> $</li> $<li> -<a href= "javascript:;" class= "wrap" > - the</a> -</li>Wuyi<li> the<a href= "javascript:;" class= "wrap" > - Wu</a> -</li> About<li> $<a href= "javascript:;" class= "wrap" > - -</a> -</li> A<li> +<a href= "javascript:;" class= "wrap" > the -</a> $</li> the<li> the<a href= "javascript:;" class= "wrap" > the the</a> -</li> in<li> the<a href= "javascript:;" class= "wrap" > the About</a> the</li> the<li> the<a href= "javascript:;" class= "wrap" > + -</a> the</li>Bayi</ul> the</div> the<script> - /* - swipe can extend optional parameters-by setting the object's key-value pairs: the startslide Integer (default: 0)-index of swipe start the speed Integer (default: 300)-the rate of advance and background, in milliseconds. the Auto Integer-Auto Slide (time in milliseconds between slides) the continuous Boolean (default: TRUE)-whether it can be looped (note: I am set to false as if it is also looping) - disablescroll Boolean (default: false)-stop touch swipe the stoppropagation Boolean (default: false)-stop event propagation the callback Functions-callback function, you can get the index of the picture in the slide. the Transitionend Function-functions that are executed after a sliding transition animation94 * */ theWindow.myswipe =NewSwipe (document.getElementById (' slider ')), { thestartslide:0, thespeed:400,98auto:3000, AboutContinuous:true, -Disablescroll:false,101Stoppropagation:false,102Callbackfunction(index, elem) {103 Console.log (index);104 Console.log (elem); the },106Transitionend:function(index, elem) {}107 });108</script>109</body> theFront end plug-in--swipe.js