Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Swipe your browser like you swipe your phone
CSS JavaScript
Branch: master
Failed to load latest commit information.
example Initial
README.md Initial
browserSwipe.jquery.json Initial
browserSwipe.js Initial
browserSwipe.min.js Initial
package.json Initial

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;
  }
}
Something went wrong with that request. Please try again.