Created
December 29, 2008 23:36
-
-
Save wuputah/41432 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// invokes +callback+ on elements found by +selector+ that have an href property value | |
// equal to the current page (pathname). It is recommended to use a selector that selects | |
// anchor (a) elements. | |
function currentPage(selector, callback) { | |
$$(selector).each(function(e) { | |
if (e.href == document.URL) { | |
callback.call(null, e); | |
} | |
}) | |
} | |
// mark current nav item as selected. This is redundant for the navigation implemented | |
// in the app, but not for a snippet. | |
Event.onReady(function() { | |
currentPage('#storyNavColumn ol a', function(e) { | |
e.addClassName('leftNavSelected'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment