I have this javascript function which does pagination to my image slider. I also would like to add keyboard arrows navigation (left and right) based on the existing javascript code. I am not much familiar with javascript.
here is my javascript code
pageSize = 1;
showPage = function(page) {
$(".comix").hide();
$(".comix").each(function(n) {
if (n >= pageSize * (page - 1) && n < pageSize * page)
$(this).show();
});
}
showPage(1);
$("#pagin li a").click(function() {
$("#pagin li a").removeClass("current");
$(this).addClass("current");
$('html, body').animate({scrollTop: $("#wrapper").offset().top}, 1000);
showPage(parseInt($(this).text()))
});
$('#pagin li').each(function(i) {
if ( i === 1 ) {
$(this).addClass('current');
}
});
Here is my jsFiddle
I have no idea how to approach it. Any help would be highly appreciated.