Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:42:46+00:00 2026-06-07T05:42:46+00:00

This seems pretty elementary, but I am trying to get a fixed-position footer div

  • 0

This seems pretty elementary, but I am trying to get a fixed-position footer div to slide & fade in when a user scrolls to the very bottom of a webpage and then slide & fade out when the user scrolls back up. I have searched Stack Overflow and others have suggested solutions, but my code causes my div to only to slide & fade in. I can’t get the div to slide & fade out when the user scrolls back up.

Also, this div slides & fades in right after I begin scrolling. I need it to wait until it gets to the bottom of the page (or an invisible div that I could place at the bottom of the page) before my fixed position div slides & fades in.

Any suggestions?

jQuery:

$(function() {
    $('#footer').css({opacity: 0, bottom: '-100px'});
    $(window).scroll(function() {
        if( $(window).scrollTop + $(window).height() > $(document).height() ) {
            $('#footer').animate({opacity: 1, bottom: '0px'});
        }
    });
});

HTML:

<div id="footer">
    <!-- footer content here -->
</div>

CSS:

#footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 100px;
    z-index: 26;
}

Thanks for helping!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:42:47+00:00Added an answer on June 7, 2026 at 5:42 am

    I think I would try doing it something like this.

    http://jsfiddle.net/lollero/SFPpf/3

    http://jsfiddle.net/lollero/SFPpf/4 – Little more advanced version.

    JS:

    var footer = $('#footer'),
        extra = 10; // In case you want to trigger it a bit sooner than exactly at the bottom.
    
    footer.css({ opacity: '0', display: 'block' });
    
    $(window).scroll(function() {
    
       var scrolledLength = ( $(window).height() + extra ) + $(window).scrollTop(),
           documentHeight = $(document).height();
    
    
        console.log( 'Scroll length: ' + scrolledLength + ' Document height: ' + documentHeight )
    
    
       if( scrolledLength >= documentHeight ) {
    
           footer
              .addClass('bottom')
              .stop().animate({ bottom: '0', opacity: '1' }, 300);
    
       }
       else if ( scrolledLength <= documentHeight && footer.hasClass('bottom') ) {           
            footer
               .removeClass('bottom')
               .stop().animate({ bottom: '-100', opacity: '0' }, 300);
    
       }
    });
    

    HTML:

    <div id="footer">
        <p>Lorem ipsum dolor sit amet</p>
    </div> 
    

    CSS:

    #footer {
        display: none;
        position: fixed;
        left: 0px;
        right: 0px;
        bottom: -100px;
        height: 100px;
        width: 100%;
        background: #222;
        color: #fff;
        text-align: center;
    }
    
    #footer p {
        padding: 10px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get my head around this query - seems pretty straight
So this seems pretty basic but I can't get it to work. I have
This seems like it should be pretty straight forward, but I'm apparently confused. I
This feels like it should be pretty simple, but not much seems to be
this is a pretty basic question but I can't seem to get it right.
This seems pretty simple and maybe I'm just overlooking the proper flag , but
I know this should be a pretty elementary issue to fix, but 1) I'm
This seems pretty basic, but I can't find the best method to do this...
This seems pretty straight forward but I'm not sure what is going wrong. I'm
This seems pretty trivial, but it is now frustrating me. I am using C#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.