MyBB Community Forums

Full Version: On Scroll Sticky Menu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've searched all over the internet for some piece of code to help me get the menu to stick to the top of the page after scrolling down passed the banner image.

Unfortunately the code I found that even semi worked has issues itself and I have no idea how to fix it.

Basically when you scroll down it will stick the top of the page but when you scroll back up it disappears and leaves a blank white space where the user area should be... 

SITE LINK: http://edherest.sunwolves.com/index.php 

JAVA/JQUERY OR WHATEVER IT IS:
$(function(){
        // Check the initial Poistion of the Sticky Header
        var stickyPanelTop = $('#panel').offset().top;
 
        $(window).scroll(function(){
                if( $(window).scrollTop() > stickyPanelTop ) {
                        $('#panel').css({position: 'fixed', top: '0px'});
                } else {
                        $('#panel').css({position: 'relative', top: '350px'});
                }
        });
  });