Note that there are some explanatory texts on larger screens.

plurals
  1. POEdit the CSS for a Slider from JQuery
    primarykey
    data
    text
    <p>I have some sliders on my webpage, and I want to change the color of one of the sliders, but only the section that is selected (e.g. Slider has range 0 to 100, and the button is on 25, I only want 0-25 to be red).</p> <p>My slider uses the following in .html file:</p> <pre><code>&lt;label for="slider-main"&gt;Main Slider: &lt;/label&gt; &lt;input type="range" name="slider-main" id="slider-main" value="25" min="0" max="100" data-highlight="true"/&gt; </code></pre> <p>The rule for when it should change color to red is below:</p> <pre><code>&lt;script&gt; if (slider-main-value-one&gt;slider-main-max) { $("#slider-main").css("background","red"); } else { $("#slider-main").css("background",""); } }) &lt;/script&gt; </code></pre> <p>This only changes the background of the label, not the slider</p> <p>Using firebug and messing around I found the element I need to change to change the actual slider color;</p> <blockquote> <p>ui-slider-bg ui-btn-active ui-btn-corner-all</p> </blockquote> <p>The problem is, I have no idea how to call this in JQuery.</p> <p>In firebug, when the label changes color, this is what is happens;</p> <pre><code>&lt;div class="ui-slider"&gt; &lt;input id="slider-main" class="ui-input-text ui-body-a ui-corner-all ui-shadow-inset ui-slider-input" type="number" data-type="range" data-highlight="true" max="100" min="0" value="25" name="slider-main" style="background: none repeat scroll 0% 0% red;"&gt; </code></pre> <p>Manually editing firebug to change the color of the slider itself is the following;</p> <pre><code>&lt;div class="ui-slider-track ui-btn-down-a ui-btn-corner-all" role="application"&gt; &lt;div class="ui-slider-bg ui-btn-active ui-btn-corner-all" style="width: 28%; background: red"&gt;&lt;/div&gt; </code></pre> <p>This is directly below the code where the label changes color.</p> <p>So all in all, the question is, how can I call the class "ui-slider-bg ui-btn-active ui-btn-corner-all" from my .js (or from .html using ?</p> <p>Thank you!</p> <p>Kind Regards,</p> <p>Gary</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload