[JS plugin] Pageswitch suitable for mobile end full screen scrolling effect of the use of the tutorial

Source: Internet
Author: User
Tags prev

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.