• Resolved tallscott

    (@tallscott)


    I’m trying to get the slider on this page to listen to the next and back keys on the keyboard. I’ve found several pieces of javascript that claim to accomplish this for Owl Carousel and have tried them all in the page header but nothing has worked. Because I’m not a developer, I’m hoping someone can tell me precisely what code to put where in order to get this working. Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author simonpedge

    (@simonpedge)

    Hi, try the following in your header (also try footer):

    jQuery(function() {
    	jQuery(document).keydown(function(eventObject) {
    		if(eventObject.which==37) { //left arrow
    			jQuery('.owl-prev').click(); //emulates click on prev button
    		} else if(eventObject.which==39) { //right arrow
    			jQuery('.owl-next').click(); //emulates click on next button
    		}
    	});
    });

    Looking at the Owl Carousel docs, it doesn’t support keyboard navigation at all. Which is kind of understandable as you can have multiple carousels/sliders per page/viewport and this could be an issue. PS: the above code won’t work if you have multiple sliders on a page.

    Thread Starter tallscott

    (@tallscott)

    Brilliant! works perfectly. Thank you so much!

    Plugin Author simonpedge

    (@simonpedge)

    Glad I could help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need slider to obey keyboard next/back.’ is closed to new replies.