bawright
2/25/2014 - 6:20 PM

Sticky Menu

Sticky Menu

/*
Sticky Menu
---------------------------------------------------------------------------------------------------- */
 
#subnav {
	background-color: #1e1e1e;
	display: none;
	position: fixed;
	top: 0;
	width: 100%;
	z-index: 999;
}
 
#subnav .wrap {
	margin: 0 auto;
	position: relative;
	width: 1152px;
}
 
#subnav .genesis-nav-menu.menu-secondary {
	border: none;
}
 
.genesis-nav-menu.menu-secondary a {
	color: #fff;
	padding: 20px;
	padding: 1.25rem;
}
 
.genesis-nav-menu.menu-secondary li.sticky-right {
	float: right;
}
 
.genesis-nav-menu.menu-secondary li li a,
.genesis-nav-menu.menu-secondary li li a:link,
.genesis-nav-menu.menu-secondary li li a:visited {
	background-color: #1e1e1e;
	border: 1px solid #fff;
	border-top: none;
	color: #fff;
	padding: 20px;
	padding: 1.25rem;
}
 
.genesis-nav-menu.menu-secondary li li a:hover {
	color: #ff2a00;
}
jQuery(function( $ ){
	$(window).scroll(function() {
		var yPos = ( $(window).scrollTop() );
		if(yPos > 200) { // show sticky menu after screen has scrolled down 200px from the top
			$("#subnav").fadeIn();
		} else {
			$("#subnav").fadeOut();
		}
	});
});
<?php
//* Do NOT include the opening php tag

//* Enqueue sticky menu script
add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' );
function custom_enqueue_script() {
	wp_enqueue_script( 'sticky-menu', get_stylesheet_directory_uri() . '/js/sticky-menu.js', array( 'jquery' ), '', true );
}
 
//* Reposition the secondary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before', 'genesis_do_subnav' );