diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-11-09 03:10:57 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-11-09 03:10:57 +0000 |
commit | 56c6def9266f24f97857cc7068fe2d65a7b285b0 (patch) | |
tree | 7f6d331f24befa20e8dd6d9215faf1615627d460 /ui/jquery.ui.slider.js | |
parent | bff49fac188b0fa8ad85d9ce003666cd01c4dc38 (diff) | |
download | jquery-ui-56c6def9266f24f97857cc7068fe2d65a7b285b0.tar.gz jquery-ui-56c6def9266f24f97857cc7068fe2d65a7b285b0.zip |
Slider: Added paging - page up/down jumps by 1/5 the size of the range.
Fixes #3096 - Add a paging option for slider
Diffstat (limited to 'ui/jquery.ui.slider.js')
-rw-r--r-- | ui/jquery.ui.slider.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 105a08ff9..2c96bd018 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -13,6 +13,10 @@ (function($) { +// 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", $.extend({}, $.ui.mouse, { _init: function() { @@ -119,6 +123,8 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { switch (event.keyCode) { case $.ui.keyCode.HOME: case $.ui.keyCode.END: + case $.ui.keyCode.PAGE_UP: + case $.ui.keyCode.PAGE_DOWN: case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: case $.ui.keyCode.DOWN: @@ -146,6 +152,12 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { case $.ui.keyCode.END: newVal = self._valueMax(); break; + case $.ui.keyCode.PAGE_UP: + newVal = curVal + ((self._valueMax() - self._valueMin()) / numPages); + break; + case $.ui.keyCode.PAGE_DOWN: + newVal = curVal - ((self._valueMax() - self._valueMin()) / numPages); + break; case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: if(curVal == self._valueMax()) return; |