Pageswitch is a full screen scrolling JS plug-in, you can set a variety of switching effects, mobile phone can also be a good implementation.
Source code: Https://github.com/qiqiboy/pageSwitch Use instructions First, download code
Download the source code in Https://github.com/qiqiboy/pageSwitch. Second, the construction of Web pages, the introduction of relevant documents
1, the new HTML page, if it is moving the end to see, you need to insert a viewport in the page description:
<meta name= "viewport" content= "Width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, User-scalable=no ">
2, the introduction of Jquery.js library files, the introduction of pageswitch.js files. three, write the HTML structure that you want to divide several screens, and match the style
1, write in the page you want to divide a few screen HTML code, and put them all in a layer, suppose you want to divide 2 screen, as follows:
<div id= "pages" >
<div class= "page Page1 current" >
2, for this structure with the necessary style, as follows:
#pages {position:relative; overflow:hidden; width:100%; max-width:768px; height:100%; margin:0 Auto;}
. Page {position:absolute; left:0; top:0; width:100%; height:100%;}
Four, write JavaScript boot code
You can directly copy the boot code on the official web, or you can modify it, and here's a sample of the current layer with the class added to the changes after the change is made:
<script> window.onload=function () {var pw=new pageswitch (' pages ', {duration:800, int page Transition time direction:1,//int page toggle direction, 0 transverse, 1 longitudinal start:0, int defaults to display page Loop:false,//bool whether to cycle switch ease: ' ease ',//string|funct Ion transition curve Animation, see below explained transition: ' Slide ',//string|function transitions Way, see below Description freeze:false, bool whether to freeze page mouse:true,//bool whether to enable mouse drag and drop mousewheel:true,//bool Whether to enable the mouse wheel to toggle arrowkey:true,//bool whether to enable keyboard orientation toggle Autoplay:false//bool whether to play automatically
Slideshow added});
The following is a callback function, not a required pages=pw.pages;
Pw.on (' Before ', function (Now,prev) {//now is the current page index before switching $ (Pages[now]). Removeclass (' present ');
}); Pw.on (' After ', function (Now,prev) {//now is the current page index after switching $ (pageS[now]). addclass (' current ');
});
}); </script>