Skip to content

Instantly share code, notes, and snippets.

@kappuccino
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save kappuccino/2e1d0e19ed3d5b25f48b to your computer and use it in GitHub Desktop.

Select an option

Save kappuccino/2e1d0e19ed3d5b25f48b to your computer and use it in GitHub Desktop.
var swipeDir;
jQuery(function() {
function qselect_confirm(direction) {
//...
}
jQuery('.fotorama__stage, #theImage').swipe({
threshold: 0,
swipeStatus: function(event, phase, direction, distance, duration, fingerCount){
var fotorama = jQuery('.fotorama').data('fotorama')
, active;
// On change de direction = toggle options.swipe sur l'instance de fotorama
if(direction !== swipeDir){
swipeDir = direction;
active = (!(direction == 'up' || direction == 'down'));
fotorama.setOptions({swipe: active});
}
},
swipe:function(event, direction, distance, duration, fingerCount, fingerData) {
if (direction == 'up' || direction == 'down') {
console.log('qselect_confirm()', direction);
//qselect_confirm(direction);
}
}
});
document.onkeydown = function(e) {
if (e.keyCode == 80) { // "p"
console.log('UP');
}
if (e.keyCode == 77) { // "m"
console.log('DOWN');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment