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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:20:10+00:00 2026-05-10T17:20:10+00:00

Slashdot has a little widget that allows you to tweak your comment threshold to

  • 0

Slashdot has a little widget that allows you to tweak your comment threshold to filter out down-modded comments. It will be in one place if you scroll to the top of the page, and as you scroll down, at some point, where its original home is about to scroll off the page, it will switch to fixed position, and stay on your screen. (To see an example, click here.)

My question is, how can I accomplish the same effect of having a menu be in one place when scrolled up, and switch to fixed position as the user scrolls down? I know this will involve a combination of CSS and javascript. I’m not necessarily looking for a full example of working code, but what steps will my code need to go through?

  • 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. 2026-05-10T17:20:11+00:00Added an answer on May 10, 2026 at 5:20 pm

    Okay, I figured it out. I will post it here in case it help anyone else. This solution uses prototype, and an internal library that gives me the registerEvent, getElementX and getElementY functions, which do what you would think.

    var MenuManager = Class.create({     initialize: function initialize(menuElt) {         this.menu = $(menuElt);         this.homePosn = { x: getElementX(this.menu), y: getElementY(this.menu) };         registerEvent(document, 'scroll', this.handleScroll.bind(this));         this.handleScroll();     },     handleScroll: function handleScroll() {         this.scrollOffset = document.viewport.getScrollOffsets().top;         if (this.scrollOffset > this.homePosn.y) {             this.menu.style.position = 'fixed';             this.menu.style.top = 0;             this.menu.style.left = this.homePosn.x;         } else {             this.menu.style.position = 'absolute';             this.menu.style.top = null;             this.menu.style.left = null;         }     } }); 

    Just call the constructor with the id of your menu, and the class will take it from there.

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

Sidebar

Related Questions

Slashdot's RSS feed is http://rss.slashdot.org/Slashdot/slashdot . If I download the XML file directly, I
How can you keep track of time in a simple embedded system, given that
In the 1.6 API, is there a way to ensure that the onStart() method
I read this story on slashdot today where they announce a new parallel programming
When my Floating-Point Guide was yesterday published on slashdot , I got a lot
I have an array, as below: var cString = [ ['1','Techdirt','www.techdirt.com'], ['2','Slashdot','slashdot.org'], ['3','Wired','wired.com'] ];
While creating a simple client for a REST service which I have stubbed out,
In response to a recent slashdot post , I've decided I wish to add
Before anyone suggests scrapping the table tags altogether, I'm just modifying this part of
Is there a more efficient way to add objects to an NSMutable Dictionary than

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.