diff --git a/css/structure/jquery.mobile.forms.slider.css b/css/structure/jquery.mobile.forms.slider.css
old mode 100644
new mode 100755
index d22dd3e82ff..8dd1ccbf5d0
--- a/css/structure/jquery.mobile.forms.slider.css
+++ b/css/structure/jquery.mobile.forms.slider.css
@@ -4,6 +4,7 @@ input.ui-slider-input,
select.ui-slider-switch { display: none; }
div.ui-slider { position: relative; display: inline-block; overflow: visible; height: 15px; padding: 0; margin: 0 2% 0 20px; top: 4px; width: 60%; }
div.ui-slider-switch { width: 99.8%; }
+div.ui-slider-range-background {height:15px; padding:0; margin: 0; border: none}
a.ui-slider-handle { position: absolute; z-index: 10; top: 50%; width: 28px; height: 28px; margin-top: -15px; margin-left: -15px; }
a.ui-slider-handle .ui-btn-inner { padding-left: 0; padding-right: 0; }
@media all and (min-width: 480px){
diff --git a/docs/forms/slider/index.html b/docs/forms/slider/index.html
index 8cfbe85ee07..8d3e0d77ff1 100644
--- a/docs/forms/slider/index.html
+++ b/docs/forms/slider/index.html
@@ -91,6 +91,21 @@
Theming the slider
+
+ By adding a data-range-theme
attribute to the input
, a separate swatch is set for the track between the start- and the handles position.
+
+
+<div data-role="fieldcontain">
+ <label for="slider-3">Input slider:</label>
+ <input type="range" name="slider-3" id="slider-3" value="25" min="0" max="100" data-theme="a" data-range-theme="b" />
+</div>
+
+
+ This will produce a themed slider:
+
+
+
+
diff --git a/js/jquery.mobile.forms.slider.js b/js/jquery.mobile.forms.slider.js
old mode 100644
new mode 100755
index 33c624d9251..d53fd0cae0d
--- a/js/jquery.mobile.forms.slider.js
+++ b/js/jquery.mobile.forms.slider.js
@@ -8,6 +8,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
options: {
theme: null,
trackTheme: null,
+ rangeTheme: null,
disabled: false,
initSelector: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')"
},
@@ -23,8 +24,12 @@ $.widget( "mobile.slider", $.mobile.widget, {
theme = this.options.theme || parentTheme,
+ // theme of the outer track-bar
trackTheme = this.options.trackTheme || parentTheme,
+ // theme for the part between start & current slider position
+ rangeTheme = this.options.rangeTheme || trackTheme,
+
cType = control[ 0 ].nodeName.toLowerCase(),
selectClass = ( cType == "select" ) ? "ui-slider-switch" : "",
@@ -94,6 +99,9 @@ $.widget( "mobile.slider", $.mobile.widget, {
});
}
+ else if (trackTheme != rangeTheme) {
+ slider.wrapInner( "" );
+ }
label.addClass( "ui-slider" );
@@ -307,6 +315,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
newval = max;
}
+ this.slider.find('div.ui-slider-range-background').css('width', percent + "%");
this.handle.css( "left", percent + "%" );
this.handle.attr( {
"aria-valuenow": cType === "input" ? newval : control.find( "option" ).eq( newval ).attr( "value" ),
diff --git a/tests/unit/slider/index.html b/tests/unit/slider/index.html
old mode 100644
new mode 100755
index d504f5a2c19..d6bac4a1faa
--- a/tests/unit/slider/index.html
+++ b/tests/unit/slider/index.html
@@ -50,6 +50,10 @@
+
+
+
+