Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- $(window).scroll(function(){ scroll_menu(); });
- $(window).load(function(){ scroll_menu(); });
- scroll_menu();
- });
- function scroll_menu()
- {
- var offsetfilter = $("#header-wrapper").height() - 25;
- var scrollY = $(window).scrollTop();
- var menu = $('#top-container');
- if(scrollY > offsetfilter)
- {
- menu
- .css('position','fixed')
- .css('top', '-113px');
- }
- else
- {
- menu
- .css('position','absolute')
- .css('top', '0px');
- }
- }
- //HTML
- <div id="top-container" style="position: absolute; top: 0px; display: block; opacity: 1;">
- <div id="header-wrapper">
- <div id="menu-wrapper">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement