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 6621903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:19:58+00:00 2026-05-25T21:19:58+00:00

I have the below fairly simple java-script function on a webpage with a header,

  • 0

I have the below fairly simple java-script function on a webpage with a header, footer and a banner in between the header and footer right side of the body, to make the banner seem to be floating between the header and footer when users scroll the webpage.

    $(window).scroll(function()
    {      
        if ($(window).scrollTop() > headerHeight)            
            $(".banner").css("position", "fixed");                        
        else            
            $(".banner").css("position", "relative");
    }

I want the banner to be auto scrolled/floated/moved when user scrolls the browser window. The code works fine: it makes the banner float/move and stops the banner from floating/moving over the header. But I need to add one more condition: the banner must stop floating before the end of webpage is reached because a footer is present. This code now causes the banner to be moving/floating over the footer when user reaches the bottom of the page.

Can anyone help me in getting this condition included in the if block as an or condition?

  • 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-05-25T21:19:59+00:00Added an answer on May 25, 2026 at 9:19 pm

    I would recommend you use the stickyfloat jquery plugin!

    Demo: http://jsbin.com/eqihef
    http://plugins.jquery.com/project/stickyfloat

    It’s a great little plugin which gives you a lot of control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple data.frame dput(x), below: x <- structure(list(variable = c(a, b,
I have a fairly simple Hello World in X11 at end of question. But
We have a fairly simple program that's used for creating backups. I'm attempting to
I have a fairly simple task in which I need to select rows with
I'm making a fairly simple text editor, and I have a question about my
I have a DataTemplate for ListBoxItem that (should be) fairly simple, and just access
I have a fairly simple Rails 3 project where I've defined a custom route:
I'm trying to make a dynamically sizable title banner, using fairly simple image tricks.
I have a fairly simple application which downloads files in a thread. This thread
I'm fairly new to PHP and have been trying to make a simple login

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.