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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:55:06+00:00 2026-05-29T07:55:06+00:00

I am trying to make something like a thermometer but but I have a

  • 0

I am trying to make something like a thermometer but but I have a problem with it’s background.
I use the following jQuery script

<script type="text/javascript">
$(document).ready(function () {
 var bkcolor;
 $('#slider').slider({
 range: "min",
  min : 36.6,
  max  : 43,
  value: 36.6,
  step: 0.1,
  slide: function(event, ui) {

   if(ui.value<=36.8){ bkcolor='#0f0';};
   if(ui.value>36.8 && ui.value<=37.5){bkcolor='#ff0';};
   if(ui.value>37.5 && ui.value<=39){bkcolor='#f6931f';};     
   if (ui.value > 39) { bkcolor = '#f00'; }
   $('.progressbar-cover').css('bottom' , ui.value + '%');  // line 1
   $('.progressbar-value').css('backgroundColor' , bkcolor );  
   $( "#amount" ).val($( "#slider" ).slider( "value" ));   
  }
 });
});
</script>  

But I would like the element.style to be from 0 – 100%
Now, it is from 36.6 – 43%

The problem I have is on maths 🙁
How I have to edit the line 1 ?
I try to multiply with a number (1.4) and sub with another (36) to test it but it does not work properly.

Thanks a lot

  • 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-29T07:55:07+00:00Added an answer on May 29, 2026 at 7:55 am

    Try making these modifications to your code.

    I’ve also set up a demo as the following jsFiddle. As you didn’t supply any HTML or CSS, the demo only outputs the value to the screen.

    $(document).ready(function () {        
        $('#slider').slider({
            range: "min",
            min : 36.6,
            max  : 43,
            value: 36.6,
            step: 0.1,
            slide: function(event, ui) {
    
                // determine background color
                var bkcolor;
                if (ui.value<=36.8)
                    bkcolor='#0f0';
                else if (ui.value>36.8 && ui.value<=37.5)
                    bkcolor='#ff0';
                else if (ui.value>37.5 && ui.value<=39)
                    bkcolor='#f6931f';
                else if (ui.value > 39)
                    bkcolor = '#f00';
    
                // determine percentage value
                var minValue = $(this).slider('option', 'min');
                var maxValue = $(this).slider('option', 'max');
                var currentValue = ui.value;
                var percentageValue = Math.round((currentValue - minValue) / (maxValue - minValue) * 100);
    
                // update screen
                $('.progressbar-cover').css('bottom' , percentageValue + '%');  // line 1
                $('.progressbar-value').css('backgroundColor' , bkcolor );  
                $( "#amount" ).val($( "#slider" ).slider( "value" ));
            }
        });
    });
    

    Hope it helps.

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

Sidebar

Related Questions

Im trying to make something like an Rpg game atm but im really stuck
I am trying to make something like an horizontal label: But there is a
hello im trying to make something like github treeslider im new to javascript.. but
I'm trying to make something like this: I have a mapactivity and when the
I'm trying to make something like bookmarks, I have 1 note on the stage
I am trying to make something like this: Master detail gridview But give me
Hi I'm trying to make something like CMS with widgets so I have a
I'm trying to make something like plugin that outputs certain text when Qt creator
I'm trying to make something that looks like this, but I don't know how
I have been trying to make something like Facebook @tagged Friend name add in

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.