Created
October 12, 2014 12:14
-
-
Save FellowshipAgency/d1fdcc711e697846896d to your computer and use it in GitHub Desktop.
Add swipe controls to colorbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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