Skip to content

Instantly share code, notes, and snippets.

@FellowshipAgency
Created October 12, 2014 12:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FellowshipAgency/d1fdcc711e697846896d to your computer and use it in GitHub Desktop.
Save FellowshipAgency/d1fdcc711e697846896d to your computer and use it in GitHub Desktop.
Add swipe controls to colorbox
// Requires Touchswipe.js https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
jQuery(document).bind('cbox_open', function(){
jQuery("#colorbox").swipe( {
//Generic swipe handler for all directions
swipeLeft:function(event, direction, distance, duration, fingerCount) {
jQuery.colorbox.prev();
},
swipeRight:function(event, direction, distance, duration, fingerCount) {
jQuery.colorbox.next();
},
//Default is 75px, set to 0 for demo so any distance triggers swipe
threshold:0
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment