Skip to content

Instantly share code, notes, and snippets.

View steveafrost's full-sized avatar
👋

Steve Frost steveafrost

👋
View GitHub Profile
// Highlight current page menu item as user scrolls
var lastId,
pageMenu = $("nav"),
pageMenuHeight = pageMenu.outerHeight(),
// All list items
menuItems = pageMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
if (item.length) { return item; }