equal
deleted
inserted
replaced
103 this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); |
103 this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); |
104 this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); |
104 this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); |
105 } else { |
105 } else { |
106 this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; |
106 this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; |
107 this.handle2.addClass('hide'); |
107 this.handle2.addClass('hide'); |
108 if (this.selection == 'after') { |
108 if (this.selection === 'after') { |
109 this.value[1] = this.max; |
109 this.value[1] = this.max; |
110 } else { |
110 } else { |
111 this.value[1] = this.min; |
111 this.value[1] = this.min; |
112 } |
112 } |
113 } |
113 } |
167 }, |
167 }, |
168 |
168 |
169 layout: function(){ |
169 layout: function(){ |
170 this.handle1Stype[this.stylePos] = this.percentage[0]+'%'; |
170 this.handle1Stype[this.stylePos] = this.percentage[0]+'%'; |
171 this.handle2Stype[this.stylePos] = this.percentage[1]+'%'; |
171 this.handle2Stype[this.stylePos] = this.percentage[1]+'%'; |
172 if (this.orientation == 'vertical') { |
172 if (this.orientation === 'vertical') { |
173 this.selectionElStyle.top = Math.min(this.percentage[0], this.percentage[1]) +'%'; |
173 this.selectionElStyle.top = Math.min(this.percentage[0], this.percentage[1]) +'%'; |
174 this.selectionElStyle.height = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; |
174 this.selectionElStyle.height = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; |
175 } else { |
175 } else { |
176 this.selectionElStyle.left = Math.min(this.percentage[0], this.percentage[1]) +'%'; |
176 this.selectionElStyle.left = Math.min(this.percentage[0], this.percentage[1]) +'%'; |
177 this.selectionElStyle.width = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; |
177 this.selectionElStyle.width = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; |
337 this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); |
337 this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); |
338 this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); |
338 this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); |
339 } else { |
339 } else { |
340 this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; |
340 this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; |
341 this.handle2.addClass('hide'); |
341 this.handle2.addClass('hide'); |
342 if (this.selection == 'after') { |
342 if (this.selection === 'after') { |
343 this.value[1] = this.max; |
343 this.value[1] = this.max; |
344 } else { |
344 } else { |
345 this.value[1] = this.min; |
345 this.value[1] = this.min; |
346 } |
346 } |
347 } |
347 } |
361 data = $this.data('slider'), |
361 data = $this.data('slider'), |
362 options = typeof option === 'object' && option; |
362 options = typeof option === 'object' && option; |
363 if (!data) { |
363 if (!data) { |
364 $this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options)))); |
364 $this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options)))); |
365 } |
365 } |
366 if (typeof option == 'string') { |
366 if (typeof option === 'string') { |
367 data[option](val); |
367 data[option](val); |
368 } |
368 } |
369 }); |
369 }); |
370 }; |
370 }; |
371 |
371 |