Slider: Move numPages into the widget prototype.

This commit is contained in:
Scott González 2013-09-17 09:41:20 -04:00
parent 3317ec8990
commit 8dbda00896

View File

@ -15,10 +15,6 @@
*/ */
(function( $, undefined ) { (function( $, undefined ) {
// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
var numPages = 5;
$.widget( "ui.slider", $.ui.mouse, { $.widget( "ui.slider", $.ui.mouse, {
version: "@VERSION", version: "@VERSION",
widgetEventPrefix: "slide", widgetEventPrefix: "slide",
@ -41,6 +37,10 @@ $.widget( "ui.slider", $.ui.mouse, {
stop: null stop: null
}, },
// number of pages in a slider
// (how many times can you page up/down to go through the whole range)
numPages: 5,
_create: function() { _create: function() {
this._keySliding = false; this._keySliding = false;
this._mouseSliding = false; this._mouseSliding = false;
@ -637,10 +637,12 @@ $.widget( "ui.slider", $.ui.mouse, {
newVal = this._valueMax(); newVal = this._valueMax();
break; break;
case $.ui.keyCode.PAGE_UP: case $.ui.keyCode.PAGE_UP:
newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); newVal = this._trimAlignValue(
curVal + ( (this._valueMax() - this._valueMin()) / this.numPages ) );
break; break;
case $.ui.keyCode.PAGE_DOWN: case $.ui.keyCode.PAGE_DOWN:
newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); newVal = this._trimAlignValue(
curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
break; break;
case $.ui.keyCode.UP: case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT: case $.ui.keyCode.RIGHT:
@ -674,7 +676,6 @@ $.widget( "ui.slider", $.ui.mouse, {
} }
} }
} }
}); });
}(jQuery)); }(jQuery));