As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label jknav. Show all posts

I have a project called jquery-jknav, which was not hosted on GitHub until two months ago. I also set up a Google Alerts for monitoring and I just got another notification, I want to see if anyone makes good use of it.

But every a few months, I will see people post exactly source code of jknav, here is a screenshot of well-used keyword:

The most bizarre thing which I can't understand is not why people duplicate the code, but why they duplicate the very old version, which is The latest version is

The strange thing is they all duplicated the same old version. To be honest, I will have to dig for a while to find that version from the old Hg repo on Google Code. I didn't tag versions when did a release at that time.

I can only guess there must be a website provides the code of that version and people don't even bother to check up for updates. The release date is noted in source as you can see in the screenshot above. Almost two years, it is very old.

It's funny, when you search for "jknav," the project website will be listed at fourth place and first two are my blog posts about jknav which I have updated the links.

As for duplicating, I don't understand the need of putting the exactly the same code on Pastebin if there is no modification involved. Isn't a link to where you read it a better option?

I had thought about a jQuery plugin for jk binding navigation for a while and I finally wrote it. This jQuery plugin actually is my first plugin.


I have removed jknav from this blog, please check out the demo page, instead. (2010-09-20)

Here is what you can try to see how it works on this blog: Press h and l to navigate between posts; j and k to navigate between sections.

I have the following code installed:

<script src=""></script>
$.jknav.init({up: 'l', down: 'h', reevaluate: true});

$('h3,h4,h5,h6').jknav(null, 'all-headers');
$.jknav.init({name: 'all-headers', reevaluate: true});

It actually has two navigation settings, jk and hl.

Basically, you use jQuery to select what element should be navigated to by calling jknav(), then init() to set up some variable that plugin needs and the keyup event handler, done. Thats all. You can call jknav() as many times as your like, and the selectors dont have to be the same, you can mix tag names. This plugin will sort them by their position on page, top to bottom, left to right.

You can read the documentation and check out this demo page, which uses callback.