How do I use a different image for each JQuery UI Slider handle

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2009-08-04T12:33:43Z Indexed on 2010/03/08 5:21 UTC
Read the original article Hit count: 457

Filed under:
|
|
|

I'm using a JQuery UI slider which has two handles (a.k.a range slider). I know how to style the first handle:

.ui-slider-horizontal .ui-slider-handle {background: white url(http://stackoverflow.com/content/img/so/vote-arrow-down.png) no-repeat scroll 50% 50%;}

But how do I style the second handle differently?

Using Firebug I can see Jquery does not uniquely identify each handle:

<div id="hourlyRateSlider" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">
 <div class="ui-slider-range ui-widget-header" style="left: 26%; width: 46%;"/>
 <a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 26%;"/>
 <a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 72%;"/>
</div>

So I imagine I have to use either a CSS child selector which could be cross-browser problematic. Or I could use some JQuery trickery to add a CSS class to the second handle? Anyone done this in a neat way before?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css