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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:47:39+00:00 2026-06-08T11:47:39+00:00

Been battling with this for a while. Seems simple enough but I seem to

  • 0

Been battling with this for a while. Seems simple enough but I seem to lack the logic required to get it to work.

I want to convert the vertical .scrollTop position to a horizontal bar that represents the users vertical position in the document.

I think my math is terrible; am ready to be shot down in flames.

var pos = $("#content").scrollTop();
var convert = (pos / 1024);

$(document).scroll(function() {
    $(".place").animate({
        left: '+=' + pos
    }, slow);
});​

Here’s a fiddle of where I am so far. The ‘place’ div doesn’t want to move.

  • 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-08T11:47:42+00:00Added an answer on June 8, 2026 at 11:47 am

    Start by converting the scroll position into a percentage

     var s = $(window).scrollTop(),
        d = $(document).height(),
        c = $(window).height();
      var percent =  scrollPercent = (s / (d-c))
    

    then get your current position by using that percentage for the width of the .placebar

    var newPos = percent*1024;
    
    if(newPos > 984) { //check to stop limit
       newPos = 984;
    }
    
    $("#place").stop().animate({
        left: newPos +"px"
    });
    

    Fiddle

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

Sidebar

Related Questions

I've been battling this all day and can't seem to get the result I
I've been battling with this for some time and seem to be getting nowhere.
I've been battling this one for a while now. I have a stored proc
Been battling with this one for what seems, like forever. I have an array:
I have been battling with this code for quite a while and just don't
I've been battling with this for a while, I'm not familiar with PHP syntax,
I have been battling with this for a while, so any help would be
I've been battling this demon for a while (at least since about 6.8) and
Hey I have been battling with this problem for a while now. Perhaps there
I've been battling to get this right...basically I have the following HTML setup: <div

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.