aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.slider.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2009-01-29 15:13:47 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2009-01-29 15:13:47 +0000
commitbcee037715691a8ae3d925777686132c73a819af (patch)
tree9fa2dad366ac230b70438509c285219cda8f182d /ui/ui.slider.js
parent8218b0630783ca3a757072df219eb63df6f25181 (diff)
downloadjquery-ui-bcee037715691a8ae3d925777686132c73a819af.tar.gz
jquery-ui-bcee037715691a8ae3d925777686132c73a819af.zip
slider: fixed orientation detection
Diffstat (limited to 'ui/ui.slider.js')
-rw-r--r--ui/ui.slider.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/ui/ui.slider.js b/ui/ui.slider.js
index 03d7bc6cc..583f51504 100644
--- a/ui/ui.slider.js
+++ b/ui/ui.slider.js
@@ -20,8 +20,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
var self = this, o = this.options;
this._keySliding = false;
this._handleIndex = null;
- this.orientation = o.orientation == 'auto' ? (this.element[0].offsetWidth/this.element[0].offsetHeight > 1 ? 'horizontal' : 'vertical') : o.orientation;
-
+ this._detectOrientation();
this._mouseInit();
this.element
@@ -249,6 +248,10 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
return false;
},
+
+ _detectOrientation: function() {
+ this.orientation = this.options.orientation == 'auto' ? (this.element[0].offsetWidth/this.element[0].offsetHeight > 1 ? 'horizontal' : 'vertical') : this.options.orientation;
+ },
_normValueFromMouse: function(position) {
@@ -381,11 +384,11 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
switch (key) {
case 'orientation':
- this.orientation = this.options.orientation == 'auto' ? (this.element[0].offsetWidth/this.element[0].offsetHeight > 1 ? 'horizontal' : 'vertical') : this.options.orientation;
-
+ this._detectOrientation();
+
this.element
.removeClass("ui-slider-horizontal ui-slider-vertical")
- .addClass("ui-slider-" + this._orientation());
+ .addClass("ui-slider-" + this.orientation);
this._refreshValue();
break;
case 'value':