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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:39:36+00:00 2026-06-05T16:39:36+00:00

So i have a long scrolling 1page website with a fixed navigation bar. With

  • 0

So i have a long scrolling 1page website with a fixed navigation bar.

With this navigation bar I would like to track its .offset().top so I may add or remove classes based on the offset from the top of the window.

Live code link

Example (this is my logic but i cannot make the jQuery alert even work.

$(window).scroll(function () {
  var elem = $('.navigation');
  var topValue = offset.top;
  if (topValue > 400) {
    alert(topValue);
  }
});
  • 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-05T16:39:37+00:00Added an answer on June 5, 2026 at 4:39 pm

    Try jQuery Waypoints. Instead of specifying an offset, you use the elements on your page to trigger a callback whenever they come into view:

    $(function () {
      $("#map").waypoint(function () {
        alert("Scrolled to #map");
      });
    });
    

    Edit:

    But to properly answer your question, your navigation will always be in the same position because position: fixed positions your element relative to the viewport, not the page. If you want to do this without Waypoints, just check the body tag’s scrollTop:

    $(function () {
      $(window).scroll(function () {
        var offset = $("body").scrollTop();
        if (offset > 400)
          alert("Scrolled to 400");
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is going to be a long post. I would like to have suggestions
I have a long HTML list of say, 30 items. I would like to
How long have the MySQL XML functions like ExtractValue() and UpdateXML() been supported? A
I have a long scrolling list of EditText items created by a SimpleCursorAdapter and
I have a potentially very long scrolling log of messages within a UITableView The
Got stuck while trying to make an element in website behave like this: <div
Specifically, I am talking about this code: $(window).scroll(function(){ var loc = $('html').offset().top; }); To
I have 200+ uiLabels on a long scrollview, I need to improve scrolling performance.
What I want to do is, make layout like this: Title Date Long text
I have a full-screen TextView holding a long Spanned that requires scrolling. The TextView's

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.