summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-03-26 19:54:37 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-03-26 19:54:37 +0100
commite2fb2ab1e2b5925f16d4dd5c3ac514a0e54ee026 (patch)
tree2d264e97aee9ea9628b024ddf45b404d7269eef8
parenteaaa9da0c4912f782c3a1043b710ac1b598a41a5 (diff)
Fix #502
-rw-r--r--framework/Web/Javascripts/source/prado/controls/slider.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/framework/Web/Javascripts/source/prado/controls/slider.js b/framework/Web/Javascripts/source/prado/controls/slider.js
index e18fde84..1f1507e9 100644
--- a/framework/Web/Javascripts/source/prado/controls/slider.js
+++ b/framework/Web/Javascripts/source/prado/controls/slider.js
@@ -18,17 +18,9 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl,
this.maximum = this.options.maximum || this.range[1];
this.minimum = this.options.minimum || this.range[0];
this.hiddenField=jQuery('#'+this.options.ID+'_1').get(0);
+ this.trackInitialized=false;
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft);
- this.alignY = parseInt(this.options.alignY || - this.track.offsetTop);
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
- this.handleLength = this.isVertical() ?
- (this.handle.offsetHeight != 0 ?
- this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) :
- (this.handle.offsetWidth != 0 ? this.handle.offsetWidth :
- this.handle.style.width.replace(/px$/,""));
+ this.initializeTrack();
this.active = false;
this.dragging = false;
@@ -63,6 +55,24 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl,
this.observe(this.hiddenField, "change", jQuery.proxy(this.doPostback,this,options));
},
+ initializeTrack : function()
+ {
+ if(this.trackInitialized || !$(this.track).is(":visible"))
+ return;
+
+ // Will be used to align the handle onto the track, if necessary
+ this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft);
+ this.alignY = parseInt(this.options.alignY || - this.track.offsetTop);
+
+ this.trackLength = this.maximumOffset() - this.minimumOffset();
+ this.handleLength = this.isVertical() ?
+ (this.handle.offsetHeight != 0 ?
+ this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) :
+ (this.handle.offsetWidth != 0 ? this.handle.offsetWidth :
+ this.handle.style.width.replace(/px$/,""));
+ this.trackInitialized=true;
+ },
+
doPostback : function(options, event)
{
new Prado.PostBack(options, event);
@@ -149,6 +159,7 @@ Prado.WebUI.TSlider = jQuery.klass(Prado.WebUI.PostBackControl,
startDrag: function(event) {
if (event.which === 1) {
+ this.initializeTrack();
// left click
if(!this.disabled){
this.active = true;