Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Hiding header on scroll issue

    Hi there,

    I have put together some Js to make the header slide up when the user scrolls down and when the scrolls up the header slides back in. Here is the site so you can understand what I mean http://psnew.websitedesignmockup.com/ .

    The problem is I want to tell the JS not to hide when scrolling down until about 300 pixels. Also when scrolling down for the header not to scroll up straight away maybe after 5px. I am trying to replicate the mailchimp header as it is pretty awesome. Here is the code I have so far :-

    var mywindow = $(window);
    var mypos = mywindow.scrollTop();
    var up = false;
    var newscroll;
    mywindow.scroll(function () {
        newscroll = mywindow.scrollTop();
        if (newscroll > mypos && !up) {
            up = !up;
        } else if(newscroll < mypos && up) {
            up = !up;
        mypos = newscroll; 
    Last edited by VIPStephan; 10-02-2013 at 12:10 PM. Reason: fixed code BB tag


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts