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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:42:36+00:00 2026-06-09T00:42:36+00:00

I am about to author this client-side widget slider in javascript. As users answer

  • 0

I am about to author this client-side widget slider in javascript.

As users answer questions, the slider will increment.

I’m ok with making the slider background grow and shrink, but what I’m not really sure about is have the “65%” indicator “stick” to the end of the blue-coloured div, and automagically move as the slider background grows and shrinks.

Since this is javascript, i’m cool with setting the indicator’s absolute position dynamically. OK, I havent really tried anything yet, because I’m guessing there are a number of ways to achieve this, so wanted to get some opinions. I’m even contemplating using qTip…but would be great to see this with css as a floating box anchored to another box

I’m imagining changing the width of two side-by-side divs (the completed vs incompleted), and have the indicator absolutely positioned relative to its container, so that it moves as the widths changes.

Possible?

Here’s what I’m talking about:

enter image description here

Working example (thanks to Philip’s answer)

http://jsfiddle.net/HP7V9/

  • 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-09T00:42:40+00:00Added an answer on June 9, 2026 at 12:42 am

    I’d probably just use jQuery to anchor it to the right of the loaded div and at the halfway point of the of the height of it.

    So lets say we have this DOM:

    Then, assuming you have the logic to resize the bar already, this jQuery would do the trick:

    $("#loaded").resize(function(){
        var loadedDiv = $("#loaded");
        var loadedPosition = loadedDiv.position();
        var percentXPos = loadedPosition.left + loadedDiv.width() - $("#percent").width()/2;
        var percentYPos = loadedPosition.top + loadedDiv.height() / 2 - loadedDiv.height() / 2;
    
        $("#percent").css({
            position: "absolute",
            top: percentYPos.toString() + "px",
            left: percentXPos.toString() + "px"
        });
    });
    

    Also, I don’t think there’s any reason to have a div for the not loaded part. You should make a div for the whole bar and give it a black background, then give the loaded div a higher z-index and different background color.

    Keep in mind it may need minor tweaks depending on the margin, padding, etc of the elements.

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

Sidebar

Related Questions

In this reddit blog post , the author talks about MD5ing the cache keys
I'm reading a book about C++. The author shows this enum: [Flags] enum class
I read this article here that talks about progressive enhancement for javascript and the
i have build an About the Author views block in Drupal. This is linked
I'm reading a book about GWT (Google Web Toolkit) where the author quote the
I am learning about XML Attributes from W3Schools . The author mentions the following
I have about 100 Word documents which include transliteration of foreign names. The author
I haven't read much about it, but the author at the link below recommends
The answer to just about every single question about using C# with JSON seems
i have installed WP About Author plugin on my wordpress blog now here as

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.