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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:56:55+00:00 2026-05-24T18:56:55+00:00

I’m trying to build a slider-controlled bargraph that uses data from arrays. I’ve managed

  • 0

I’m trying to build a slider-controlled bargraph that uses data from arrays. I’ve managed to get it working using some really messy code here, but I made a much cleaner version here that should work but doesn’t. Actually, it works perfectly as far a capturing data from the arrays, but it breaks when I put in the code that animates the boxes. Then the slider stops moving and the boxes only animate if they have a real number in them (i.e. column 1). I can only post two links, but you can see a version with a working slider if you rename that file to laborslider2_noslide.html.

The thing that confuses me is that, despite the broken slider-handle, the numbers ARE getting passed to the variables (column1, column2, and column3), and the box with a real number in it animates, but none of the variable boxes do a thing. I don’t see why that would be.

I’m new to jquery, so it could be something really dumb. Hopefully it’s something really dumb. 😉

Here’s my code:

<!DOCTYPE html>
<html class="no-js">
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>-->
    <script type="text/javascript" src="http://img.seiu.org/js/custom-link-tracking.js"></script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js" type="text/javascript"></script>
<script> 



 $(document).ready(function () {

var updateSizes = function (s) {

    var column1 = s[0];
    var column2 = s[1];
    var column3 = s[2];


     return "Column 1: " + column1 + ", Column 2: " + column2 + ", Column 3: " + column3;

},
laborData = Array(14);

laborData[0] = [100, 6, 38];
laborData[1] = [300, 6.5, 38.5];
laborData[2] = [500, 7, 39];
laborData[3] = [6.5, 7.5, 40];
laborData[4] = [7, 8, 40.5];
laborData[5] = [8, 9, 42];
laborData[6] = [8.5, 9.5, 42.5];
laborData[7] = [9, 10, 43];
laborData[8] = [9.5, 10.5, 44];
laborData[9] = [10, 11, 44.5];
laborData[10] = [10.5, 11.5, 45];
laborData[11] = [11, 12, 46];
laborData[12] = [11.5, 12.5, 46.5];
laborData[13] = [12, 13, 47];



$("#slider").slider({
    range: "max",
    min: 0,
    max: 13,
    step: 1,
    slide: function (event, ui) {
      $("#amount").val(updateSizes(laborData[ui.value]));

     $("#box").animate({"height":300});
     $("#box2").animate({"height":column2});
     $("#box3").animate({"height":column3});    




    }
});


//    $("#slider-men").slider({
//        range: "max",
//        min: 0,
//        max: 13,
//        step: 1,
//        slide: function (e, ui) {
//            $("#amount-men").val(updateSizes(laborData[ui.value]));
//        }
//    });

});
</script>

</head>
<body>
<div id="slider"></div> 
<label for="amount">Data:</label> <input type="text" id="amount" style="border:0;  color:#f6931f; font-weight:bold;width:300px;" /> 

<p>

<div id="box" style="background:#98bf21;height:100px;width:100px;margin:6px; float: left;">
</div>
<div id="box2" style="background:#98bf21;height:100px;width:100px;margin:6px; float: left;">
</div>
<div id="box3" style="background:#98bf21;height:100px;width:100px;margin:6px; float: left;">
</div>



</body>
</html>

So yeah. Any help would be great. I’m stumped.

  • 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-05-24T18:56:56+00:00Added an answer on May 24, 2026 at 6:56 pm

    You have to define the column1/2/3 variables in the global scope because you are setting it in one function and accessing it in another function.

    I have set up a fiddle and fixed it, take a look. I believe you want the box animation to be in parallel so I have set the queuing of box animation to false

    Working demo

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.