I'm creating a presentation using HTML for a project I'm working on. The presentation will be full-page slides and I want to implement a script with jQuery so that when the arrow keys are pressed, it scrolls smoothly between slides. Left being previous slide and right being next slide obviously.
I wrote a script but it only works the first time. I'm very new to jQuery and I can't seem to fix it.
The page the presentation will be on is: http://ift.tt/1ekJPbP
<script type="text/javascript">
$(document).keydown(function(e){
if (e.keyCode == 37) {
$('.slide').previous().ScrollTo({
duration: 2000,
easing: 'linear'
});
}
if (e.keyCode == 39) {
$('.slide').next().ScrollTo({
duration: 2000,
easing: 'linear'
});
}
});
</script>
Aucun commentaire:
Enregistrer un commentaire