特定の位置に来たらメニューを固定する
.menuFix {
position: fixed;
top: 0px;
z-index: 1000;
}
//メニュー固定
jQuery( function() {
var $offset = jQuery( '#mainMenuWrap' ).offset();
jQuery( window ).scroll( function () {
if( jQuery( window ).scrollTop() > $offset.top ) {
jQuery( '#mainMenuWrap' ).addClass( 'menuFix' );
} else {
jQuery( '#mainMenuWrap' ).removeClass( 'menuFix' );
}
} );
} );