From: jzaefferer Date: Wed, 1 Dec 2010 22:28:05 +0000 (+0100) Subject: Spinner: Introduce page option to configure page size. Use that for timespinner demo... X-Git-Tag: 1.9m4~88^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0d0ec376e35f1eaaba8199c2abc83a17d5c655a8;p=jquery-ui.git Spinner: Introduce page option to configure page size. Use that for timespinner demo to spin minutes on cursor up/down, hours on page up/down. --- diff --git a/demos/spinner/time.html b/demos/spinner/time.html index 2f55d0f09..4913a6307 100644 --- a/demos/spinner/time.html +++ b/demos/spinner/time.html @@ -8,7 +8,6 @@ - @@ -16,25 +15,31 @@ @@ -44,7 +49,14 @@

- + +

+

+ +

diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 7f32adbd8..39a498359 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -13,15 +13,13 @@ */ (function($) { -// shortcut constants -var pageModifier = 10; - $.widget('ui.spinner', { options: { incremental: true, max: null, min: null, numberformat: null, + page: 10, step: null, value: null }, @@ -161,10 +159,10 @@ $.widget('ui.spinner', { this._repeat(null, -1, event); return false; case KEYS.PAGE_UP: - this._repeat(null, pageModifier, event); + this._repeat(null, this.options.page, event); return false; case KEYS.PAGE_DOWN: - this._repeat(null, -pageModifier, event); + this._repeat(null, -this.options.page, event); return false; case KEYS.ENTER: @@ -340,11 +338,11 @@ $.widget('ui.spinner', { }, pageUp: function(pages) { - this.stepUp((pages || 1) * pageModifier); + this.stepUp((pages || 1) * this.options.page); }, pageDown: function(pages) { - this.stepDown((pages || 1) * pageModifier); + this.stepDown((pages || 1) * this.options.page); }, value: function(newVal) {