jquery - automatic scrolling when using keytable plugin -
i'm using allan jardine's keytable plugin in plain html table. it's big table scrolls horizontally , vertically. problem i'm facing right doesn't scroll automatically when focused cell out of sight (one knows current cell because has .focus class).
how make scroll automatically when using keyboard?
thanks.
i use nice scrollintoview plugin jquery: https://github.com/litera/jquery-scrollintoview this.
my own code, nice still not perfect, works this:
var anim_element = $(); var keys = new keytable( { "table": t, focus: false, }); keys.event.focus( null, null, function(cell, posx, posy) { /* handler focus events on cells ... */ anim_element.stop(); var row = $(cell).parents("tr").first(); anim_element = row.stop().scrollintoview({ duration: 50, direction: 'y'}); });
note have stop animation when next focus event starts have have previous animation element stored somewhere. part of code that's still little rough.
hope helps.
Comments
Post a Comment