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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:23:36+00:00 2026-06-07T02:23:36+00:00

I have a series of elements, one beneath the next. There will be content

  • 0

I have a series of elements, one beneath the next. There will be content at the top of each of these elements but a space at the bottom over which a horizontal bar will sit.

There is only one horizontal bar on the page. It needs to be ‘fixed’ to the bottom of the first element until that element is scrolled out of view, at which point it needs to animate to the bottom of the currently-in-view element.

I’ve mocked up a fiddle which shows some logic for highlighting the currently active section, which I’m happy with. The sections are grey by default. The most-in-view section as you scroll up and down turns red to indicate that it’s the active section – which works fine. The horizontal bar is in blue.

What I’m struggling with is getting the blue bar to animate down to the bottom of the red section as it changes on scroll.

http://jsfiddle.net/9kW5N/2/

The main reason my code in the fiddle isn’t working I think is because the window scroll event isn’t ‘live’ so doesn’t know what the currently active (red) section is.

Can anyone suggest how to achieve this?

Thanks for any pointers folks!

  • 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-07T02:23:38+00:00Added an answer on June 7, 2026 at 2:23 am

    So I changed some code in your changeSection() function. It sort of works, but definitely not perfect. Maybe it will point you in the right direction though?

    Also commented out the animation onScroll.

    function changeSection() {
        $('.active').removeClass('active');
        var currentlyActive = $('section').eq(closestArrPos);
        currentlyActive.addClass('active');
        $("#horiz").animate({"top" : currentlyActive[0].offsetTop + currentlyActive.height()}, "fast");
    }
    

    DEMO : http://jsfiddle.net/9kW5N/5/

    Also needed to put the window.scroll event in a setTimeOut function so it only gets called effectively after the scroll is finished rather than many times throughout.

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

Sidebar

Related Questions

If I have a series of elements with class=filler, how can I remove one
I have a series of elements (lets call them '.my-elements') - some load on
I need to represent a series of elements through time. For designing purposes each
I have a series of yes/no questions that I am displaying one at a
This will be a bit abstract but I have a method like this: private
I have a series of divs: <div class=some_class active>Some Content</div> <div class=some_class>Different Content</div> <div
I have a series of square <li> elements inside a fixed width ul .
I have two xml documents with about 1000 elements in each of them and
I have a routine that generates a series of data vectors, one iteration at
I have a series of buttons (A,B,C,D) that toggle like radio buttons, only one

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.