GithubHelp home page GithubHelp logo

weswigham / sideswipe.js Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 376 KB

Sideswipe.js is a utility for automatically ajaxifying your traditionally-designed pages with fancy touch gestures. Depends on hammer.js and jQuery.

License: MIT License

JavaScript 100.00%

sideswipe.js's Introduction

sideswipe.js

Sideswipe.js is a utility for automatically ajaxifying your traditionally-designed pages with fancy touch gestures.

Depends on hammer.js and jQuery (sorry).

How to start using sideswipe.js

$(document).ready(function() {
    var swipe = Sideswipe(".content", ["/", "/about/"]);
    //The first argument (".content") is the selector for the common 
    //section between the pages for sideswipe to transition between
    //The second argument is an array of the pages to transition between.
    
    
    swipe.onStartTransition = function(selector, url, direction, duration) {
        //selector is the selector you passed to the sideswipe function
        //url is the url sideswipe is transitioning to
        //direction is either 'left' or 'right'
        //duration is the time the transition has to complete 
        //    (determined by the velocity of the swipe gesture)
        //called whenever a transition to another page is triggered, so you can 
        //update any elements in your page that sideswipe may leave out
        //   (say, the selected element in your navbar)
    };
    swipe.onEndTransition = function() {
        //Called whenever a transition between pages finishes, 
        // useful for calling javascript that needs to be on the new page 
    };
    swipe.onLeftBound = function() {
        //Called whenever the swipe gesture is triggered to go left, but 
        // the left boundary page is already active
    };
    swipe.onRightBound = function() {
        //Same as the left bound, but for the right bound
    };
    
    swipe.left(); //Emulate a left swipe transition
    swipe.right(); //Emulate a right swipe transition
}

sideswipe.js's People

Contributors

weswigham avatar

Stargazers

曹文忠 avatar  avatar Jonathan Barratt avatar Nick McCurdy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.