javascript - jquery scroller mousewheel with keyboard -


i have site scroller here article trying add keyboard keys , down below code

[http://jsfiddle.net/roxon/r3x7r/1/]

control page scroll animation mousewheel

kindly 1 let me know if possible..

hope you,

http://jsfiddle.net/r3x7r/274

added keyboard shortcut scrolling in page sections.

// our code var winh = $(window).height(); $('.page').height(winh);  var c = 0; var pagesn = $('.page').length;  var activepage=0; $(document).bind('mousewheel', function(ev, delta) {      delta>0 ? --c : ++c ;         if(c===-1){         c=0;     }else if(c===pagesn){         c=pagesn-1;     }     activepage = c;     var pagepos = $('.page').eq(c).position().top;            $('html, body').stop().animate({scrolltop: pagepos},{easing: 'easeincirc', duration: 1200});     return false;   });  $(document).bind('keyup', function(event){     console.log(event);     if(event.which == 40) {         activepage = activepage+1;         var pagepos = $('.page').eq(activepage).position().top;                $('html, body').stop().animate({scrolltop: pagepos},{easing: 'easeincirc', duration: 1200});     } else if(event.which == 38) {         activepage = activepage-1;         var pagepos = $('.page').eq(activepage).position().top;                $('html, body').stop().animate({scrolltop: pagepos},{easing: 'easeincirc', duration: 1200});     }      return false; }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -