lundi 2 mars 2015

Owl Carousel Keyboard Navigation


I'm looking to add keyboard navigation to the Owl Carousel plugin. The original jQuery plugin's Github has a thread on this topic here, so I've tried the following:



var owl = $('.owl-carousel');

$(document.documentElement).keyup(function(event) {
if (event.keyCode == 37) {
owl.prev();
} else if (event.keyCode == 39) {
owl.next();
}
});


Others used #owl-carousel as the selector, but in the Wordpress version it has a string of ever-changing numbers attached to it, so I didn't want to touch that. I don't think using the class will make a difference as they both target the main carousel div.


No matter what I try, I'm getting an "undefined is not a function".


I have tried using my theme's "raw js" input in visual composer, and editing the plugin's source files. I'm not sure if this is Wordpress-specific, or if I'm overlooking something very obvious. Any insight would be much appreciated!


I'm using the carousel here: http://ift.tt/1AONuGM





Aucun commentaire:

Enregistrer un commentaire