The delegate
version of navim allows you to write your own
"up" and "down" functions for navim to call. This can be useful in a number of
cases, for example:
It's up to you...
function init_vim() { // note: a scenario this simple should just use the standard // mode, rather than a delegate. This is just to illustrate the // delegate callbacks var delegate = { up: function(currentElement) { if(currentElement == null) return null; return $(currentElement).prev('.scrollable'); }, down: function(currentElement) { if(currentElement == null) return $('.scrollable').eq(0); var next_elem = $(currentElement).next('.scrollable'); if(next_elem.length == 0) { return currentElement; } else { return next_elem; } } }; // now install our navigation delegate with navim: $.vimNavigation(delegate); } $(init_vim);
See the main example for an overview of navim, as well as download instructions.
Here's some more <li> elements for you to select (using "j" and "k"):