Ticket #416 (closed enhancement: invalid)
Slider doesn't support resizing of slider
| Reported by: | make-contact@… | Owned by: | |
|---|---|---|---|
| Type: | enhancement | Priority: | trivial |
| Milestone: | Component: | Core | |
| Keywords: | slider | Cc: |
Description
I'm working on a web page that uses slider. It's great... except you can't resize the slider (e.g. the slider & knob have percentage widths). The following allows me to, in my window resize event handler resize the slider. sizeSlider() could replace the code block in initialize, in order to save duplication. resizeSlider() is what I call, followed by set() (I call that with either the current value or 0, depending on app requirements).
Slider.prototype.sizeSlider = function() {
var mod, offset;
switch(this.options.mode){
case 'horizontal':
this.z = 'x';
this.p = 'left';
mod = {'x': 'left', 'y': false};
offset = 'offsetWidth';
break;
case 'vertical':
this.z = 'y';
this.p = 'top';
mod = {'x': false, 'y': 'top'};
offset = 'offsetHeight';
}
this.max = this.element[offset] - this.knob[offset] + (this.options.offset * 2);
this.half = this.knob[offset]/2;
this.getPos = this.element['get' + this.p.capitalize()].bind(this.element);
this.knob.setStyle('position', 'relative').setStyle(this.p, - this.options.offset);
var lim = {};
lim[this.z] = [- this.options.offset, this.max - this.options.offset];
return lim;
};
Slider.prototype.resizeSlider = function() {
this.drag.options.limit = this.sizeSlider();
};
Change History
Note: See
TracTickets for help on using
tickets.