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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:26:37+00:00 2026-05-30T11:26:37+00:00

I am using for a short period ui slider utility and ended with the

  • 0

I am using for a short period ui slider utility and ended with the following situation. I have three sliders combined in order to use their result and alter an object’s css box-shadow. This is my code:

$('#slider2, #slider3, #slider4').slider({
    range: 'min',
    min: 0,
    max: 100,
    step: 1,
    animate: true,
    slide: function(x,y,z) {
        var x = $('#slider2').slider('value'),
            y = $('#slider3').slider('value'),
            z = $('#slider4').slider('value')
        $('#xShadowValue').val(x + ' px');
        $('#yShadowValue').val(y + ' px');
        $('#zShadowValue').val(z + ' px');          
        $('#target').css('box-shadow', x + 'px ' + y + 'px ' + z + 'px ' + '#888888');
    }
});

$('#xShadowValue').val($('#slider2').slider('value') + ' px');
$('#yShadowValue').val($('#slider3').slider('value') + ' px');
$('#zShadowValue').val($('#slider4').slider('value') + ' px');

Problem is when i change the first one all is fine. When i change the second one the first one drops or increases a unit same when i change the third occurs for the second one. Furthermore i cannot slide all of them to 0 or 100. A limit appears at 1 and 99 accordingly. Thanx in advance.

  • 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-30T11:26:38+00:00Added an answer on May 30, 2026 at 11:26 am

    The reason for this is that you are using $("#slider").slider("value") to retrieve the value.

    This is not mentioned in the documentation from what I could see, but according to a note in this bug ticket, you should use ui.value to get the new value of the slider and the value method to get the old value of the slider. This explains both of your issues.

    With that in mind, you have to tweak your code a bit so that you take advantage of ui.value for each slider.

    I would change two things:

    1. Use data-* attributes to designate which slider corresponds to which axis:

      <div id="slider2" class="slider" data-axis="x"></div>
      <div id="slider3" class="slider" data-axis="y"></div>
      <div id="slider4" class="slider" data-axis="z"></div>
      
    2. Update your slide callback to leverage those attributes:

      var boxShadow = {
          x: 0,
          y: 0,
          z: 0
      };
      
      $('#slider2, #slider3, #slider4').slider({
          step: 1,
          animate: true,
          slide: function(event, ui) {
              var axis = $(this).data("axis");
      
              boxShadow[axis] = ui.value;
      
              $('#xShadowValue').val(boxShadow.x + ' px');
              $('#yShadowValue').val(boxShadow.y + ' px');
              $('#zShadowValue').val(boxShadow.z + ' px');            
      
              $('#target').css('box-shadow', boxShadow.x + 'px ' + boxShadow.y + 'px ' + boxShadow.z + 'px ' + '#888888');
          }
      });
      

    Basically, keep a simple object that tracks x, y, and z. This object is easily updated using the aforementioned data-* attributes.

    Example: http://jsfiddle.net/t3gva/

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

Sidebar

Related Questions

In short, currently I am using the following code to pull records from multiple
I'm using the following query to extract the frequent short values from a mediumblob
I have never used ClearCase, but have used Subversion and for a short period
I am calculating XOR of two short integers using XOR ^ operator in a
i'm using google gadget to write a short script and try to insert to
I've been using Ninject for a short time, and I'm trying to figure out
I'm noticing short URL sites are using alphnumeric id instead of integers for unqiue
For some short and simple queries I've been using the query designer in SSMS
Someone can give me short explanation how to create bitmap runtime using GDI/GDI+ and
Short: Is there a way we can push to multiple remotes simultaneously using Github

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.