Game Development Community

Tab href

by James "Nycto" Frasca · in Site Feedback · 04/20/2007 (10:14 am) · 0 replies

This really isn't anything major, just a small annoyance. On the 'Whats New' page, the hrefs for all of the tabs are set to '#'. This means that if I click to change a tab, the browser scrolls to the top of the page.

Without trying to sound pompous, here is the snippet I use to fix this scenario when doing web design. Just trying to save you some time. It's compact and downgrades nicely:

Event.observe(window, 'load', function() {
  $$('a[href=#]').invoke('setAttribute', 'href', 'javascript:void(0);');
});

Thanks, guys