Skip to content

Instantly share code, notes, and snippets.

@grim-reapper
Forked from burners77/Floating Menu JS
Created April 12, 2017 12:51
Show Gist options
  • Select an option

  • Save grim-reapper/3f3bfffda60bee48ac5467f24a99d0aa to your computer and use it in GitHub Desktop.

Select an option

Save grim-reapper/3f3bfffda60bee48ac5467f24a99d0aa to your computer and use it in GitHub Desktop.
Floating Menu JS
// JavaScript Document
$(function(){
$(function() {
function moveFloatMenu() {
var menuOffset = menuYloc.top + $(this).scrollTop() + "px";
$('#floatMenu').animate({
top: menuOffset
}, {
duration: 700,
queue: false,
easing: 'easeOutBounce',
});
}
menuYloc = $('#floatMenu').offset();
$(window).scroll(moveFloatMenu);
moveFloatMenu();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment