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

  • SEARCH
  • Home
  • 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 4007712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:39:53+00:00 2026-05-20T08:39:53+00:00

I have a side menu on my site that i would like always visible.

  • 0

I have a side menu on my site that i would like always visible.
To accomplish this, I am using the following code sample from this page:

http://camwebdesign.com/demos/jquery-scrolling-element.html

The problem is that unlike the sample my site has a huge 1000px height footer.
When the user scrolls the content over the footer div, the side menu overlaps it.
Is there a way to modify the Jquery code where it has a boundry of 1000px on the bottom to prevent this?

Thanks!

<html> 

<title>Keep element in view while scrolling using JQuery</title> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=CDN"></script> 
<script> 
    $().ready(function() {
        var $scrollingDiv = $("#scrollingDiv");

        $(window).scroll(function(){            
            $scrollingDiv
                .stop()
                .animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow" );          
        });
    });
</script> 
<div style="float: left; width: 70%"> 

<h1>Keep element in view while scrolling using JQuery</h1> 

<div id="scrollingDiv" style="position: absolute;   top: 32px; right: 16px; width: 21%; padding: 0% 2% 2% 2%; border: 2px solid red; background-color: #ffeaea;"> 
    <h2>Scrolling Element</h2> 
    Scroll down/up to see me smoothly reposition myself and keep in view.<br /><br /> 

    <em>Smooooooooooooooooooth</em><br /> 

</div> 


 <div style="clear:both;"></div>

 <div id="footer" style="width:100%; height:1000px; background:#333; color:#FFF;" >
 <h1>Footer</h1>





 </div>
  • 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-20T08:39:54+00:00Added an answer on May 20, 2026 at 8:39 am

    Demo

    http://jsfiddle.net/NsfwM/

    fullscreen
    http://jsfiddle.net/NsfwM/embedded/result/

    JS

    var $scrollingDiv = $("#scrollingDiv");
    
    $(window).scroll(function(){            
        var y = $(this).scrollTop(),
            maxY = $('#footer').offset().top,
            scrollHeight = $scrollingDiv.height();
    
        if(y< maxY-scrollHeight ){
            $scrollingDiv
            .stop()
            .animate({"marginTop": ($(window).scrollTop()) + "px"}, "slow" );        
        }    
    });
    

    And another with your 30px offset in place
    http://jsfiddle.net/NsfwM/1/

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

Sidebar

Related Questions

I have a sticky side menu that I would like to have be able
i have simple side menu with this html code : <div id=menu> <div> Menu
I have a left side navigation menu on my page.. using url.action like below..
This is the problem I have. I have a side menu like: Options A:
I have a menu on my site that changes depending on whether the user
I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)
Ok, here is the problem: I have a left side menu that will not
I have a side menu in my site, which is currently a load of
I have a side menu that I want to to have the Admin option
On this site: http://www.rent-turkey-property.com/ I have it set so that when you select a

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.