Skip to content

Commit

Permalink
Use left/right arrow keys for changing to next/prev gallery slide
Browse files Browse the repository at this point in the history
  • Loading branch information
vfonic committed Nov 16, 2016
1 parent 2f23719 commit ee569d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/wraith/gallery_template/slideshow_template.erb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@
$(this).remove();
})
})

window.addEventListener('keydown', function(e){
var leftArrowKeyCode = 37;
var rightArrowKeyCode = 39;

e = e || window.event;

if (e.keyCode === leftArrowKeyCode) {
$('.slideshow').cycle('prev');
}
else if (e.keyCode === rightArrowKeyCode) {
$('.slideshow').cycle('next');
}
});
})
</script>
</head>
Expand Down

0 comments on commit ee569d7

Please sign in to comment.