Skip to content

Commit 8dbda00

Browse files
committed
Slider: Move numPages into the widget prototype.
1 parent 3317ec8 commit 8dbda00

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ui/jquery.ui.slider.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
*/
1616
(function( $, undefined ) {
1717

18-
// number of pages in a slider
19-
// (how many times can you page up/down to go through the whole range)
20-
var numPages = 5;
21-
2218
$.widget( "ui.slider", $.ui.mouse, {
2319
version: "@VERSION",
2420
widgetEventPrefix: "slide",
@@ -41,6 +37,10 @@ $.widget( "ui.slider", $.ui.mouse, {
4137
stop: null
4238
},
4339

40+
// number of pages in a slider
41+
// (how many times can you page up/down to go through the whole range)
42+
numPages: 5,
43+
4444
_create: function() {
4545
this._keySliding = false;
4646
this._mouseSliding = false;
@@ -637,10 +637,12 @@ $.widget( "ui.slider", $.ui.mouse, {
637637
newVal = this._valueMax();
638638
break;
639639
case $.ui.keyCode.PAGE_UP:
640-
newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
640+
newVal = this._trimAlignValue(
641+
curVal + ( (this._valueMax() - this._valueMin()) / this.numPages ) );
641642
break;
642643
case $.ui.keyCode.PAGE_DOWN:
643-
newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
644+
newVal = this._trimAlignValue(
645+
curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
644646
break;
645647
case $.ui.keyCode.UP:
646648
case $.ui.keyCode.RIGHT:
@@ -674,7 +676,6 @@ $.widget( "ui.slider", $.ui.mouse, {
674676
}
675677
}
676678
}
677-
678679
});
679680

680681
}(jQuery));

0 commit comments

Comments
 (0)