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; }
@steveafrost
steveafrost / add-months-to-gform
Created August 8, 2017 22:19
Add prev, current, and next month to Gravity Form select field
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var now = new Date(),
prev = monthNames[now.getMonth() - 1] + " " + now.getFullYear(),
current = monthNames[now.getMonth()] + " " + now.getFullYear(),
next = monthNames[now.getMonth() + 1] + " " + now.getFullYear(),
optionsField = $('.gfield_select'),
options = [prev, current, next];