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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:27:39+00:00 2026-06-11T08:27:39+00:00

I am trying to work with Jquery UI slider where I can have multiple

  • 0

I am trying to work with Jquery UI slider where I can have multiple handles:

$(function () {
        var handlers = [25, 50, 75];
        $("#slider").slider({
            min: 0,
            max: 100,
            values: handlers,
            slide: function (evt, ui) {
                for (var i = 0, l = ui.values.length; i < l; i++) {
                    if (i !== l - 1 && ui.values[i] > ui.values[i + 1]) {
                        return false;
                    }
                    else if (i === 0 && ui.values[i] < ui.values[i - 1]) {
                        return false;
                    }
                }
            }
        });
    });

Please note that one handler can’t overlap and I will need to set the handler dynamically on load, and save the handler positions on change.

The thing that i am trying to accomplish is to color the ui-content betweent the handler to different colors. I have attached the an Image.

Slider

Please advice if this is possible.

  • 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-11T08:27:40+00:00Added an answer on June 11, 2026 at 8:27 am

    One possibility would be to set the slider background to a CSS gradient and to update the gradient stops in code when the slider values change:

    $(function () {
        // the code belows assume the colors array is exactly one element bigger 
        // than the handlers array.
        var handlers = [25, 50, 75];
        var colors = ["#ff0000", "#00ff00", "#0000ff", "#00ffff"];
        updateColors(handlers);
    
        $("#slider").slider({
            min: 0,
            max: 100,
            values: handlers,
            slide: function (evt, ui) {
                updateColors(ui.values);
            }
        });
    
        function updateColors(values) {
            var colorstops = colors[0] + ", "; // start left with the first color
                for (var i=0; i< values.length; i++) {
                    colorstops += colors[i] + " " + values[i] + "%,";
                    colorstops += colors[i+1] + " " + values[i] + "%,";
                }
                // end with the last color to the right
                colorstops += colors[colors.length-1];
    
                /* Safari 5.1, Chrome 10+ */
                var css = '-webkit-linear-gradient(left,' + colorstops + ')';
                $('#slider').css('background-image', css);
        }
    });​
    

    http://jsfiddle.net/LLfWd/60/

    This code works for chrome and safari. My guess is you just have to generate multiple gradient strings (for -moz-linear-gradient, -ms-linear-gradient, etc…) the way I did it for -webkit-linear-gradient here.

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

Sidebar

Related Questions

I'm trying to get the jQuery slider to have set values to slide to
I am trying to work out a complicated jQuery selection. I have an array,
I am trying to get jquery validate to work on multiple fields. Reason being
I'm trying to do the following in jquery but can't make it work .
I have the following jquery code which doesn't work quite right when trying to
well I have been trying to get Nivo Slider to work almost all day.
I'm trying to make a simple jQuery panel slider and have it basically where
i have been trying to make 2 scripts(1 mootol and 1 jquery) work at
I'm trying to add control buttons on to the jQuery UI slider but can't
I'm trying to work with jQuery's slider plugin and it works great, only 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.