Swipe your browser like you swipe your phone
CSS JavaScript
Latest commit 8449294 Mar 17, 2014 @kenwheeler Initial
Permalink
Failed to load latest commit information.
example Initial Mar 17, 2014
README.md Initial Mar 17, 2014
browserSwipe.jquery.json Initial Mar 17, 2014
browserSwipe.js Initial Mar 17, 2014
browserSwipe.min.js Initial Mar 17, 2014
package.json Initial Mar 17, 2014

README.md

browserSwipe.js

This is a simple tool to allow for trackpad swipe events when you have disabled scrolling on your site.

Demo:

Check it out in use here

How to disabled scrolling:

html, body {
  height: 100%;
  overflow: hidden;
}

Rather than linear scrolling, this listens for a mousewheel event, and treats scrolling up or down like a swipe event on a mobile device.

How to use:

$.browserSwipe({
  up: function({
    // Do something when they swipe up
  }),
  down: function({
    // Do something when they swipe down
  })
});

Example:

$.browserSwipe({
  up: function(){
    slideHandle('up');
  },
  down: function(){
    slideHandle('down');
  }
});

function slideHandle(direction) {
  switch(direction) {
    case 'up':
      if(currentScene > 0) {
        currentScene--;
        sceneHandle();
      }
    break;
    case 'down':
      if(currentScene < ($cache.scenes.length - 1)) {
        currentScene++;
        sceneHandle();
      }
    break;
  }
}