diff options
author | Ca-Phun Ung <pazu2k@gmail.com> | 2008-08-30 19:15:08 +0000 |
---|---|---|
committer | Ca-Phun Ung <pazu2k@gmail.com> | 2008-08-30 19:15:08 +0000 |
commit | 66d90af2415a8fd5f6ad93b7553cb9d34e92064c (patch) | |
tree | fb39d9d871f0a267bbf8bdbc80389652c4edfbf8 /ui | |
parent | 7c33681e52fead153f824fc7c57de2245a1e3f1c (diff) | |
download | jquery-ui-66d90af2415a8fd5f6ad93b7553cb9d34e92064c.tar.gz jquery-ui-66d90af2415a8fd5f6ad93b7553cb9d34e92064c.zip |
spinner: changed data list to support any DOM container not just <ul>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.spinner.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/ui.spinner.js b/ui/ui.spinner.js index f55e0dcd9..2abba1495 100644 --- a/ui/ui.spinner.js +++ b/ui/ui.spinner.js @@ -25,10 +25,12 @@ $.widget('ui.spinner', { }
// data list: set contraints to object length and step size
- if (this.element.is('ul')) {
+ if (this.element.children().length > 1) {
+ this.element.addClass('ui-spinner-list');
+ $('>*', this.element).addClass('ui-spinner-listitem');
this.options.stepping = 1;
this.options.min = 0;
- this.options.max = $('li', this.element).length-1;
+ this.options.max = $('>*', this.element).length-1;
}
//Initialize needed constants
@@ -121,7 +123,7 @@ $.widget('ui.spinner', { .end();
// data list: fix height of data list spinner
- if (this.element.is('ul')) {
+ if (this.element.hasClass('ui-spinner-list')) {
this.element.parent().css('height', this.element.outerHeight());
}
@@ -216,7 +218,7 @@ $.widget('ui.spinner', { );
},
_animate: function(d) {
- if (this.element.is('ul') && ((d == 'up' && this._getValue() <= this.options.max) || (d == 'down' && this._getValue() >= this.options.min)) ) {
+ if (this.element.hasClass('ui-spinner-list') && ((d == 'up' && this._getValue() <= this.options.max) || (d == 'down' && this._getValue() >= this.options.min)) ) {
this.element.animate({marginTop: '-' + this._getValue() * this.element.outerHeight() }, {
duration: 'fast',
queue: false
@@ -243,7 +245,7 @@ $.widget('ui.spinner', { this.element.unmousewheel();
}
this.element
- .removeClass('ui-spinner-box')
+ .removeClass('ui-spinner-box ui-spinner-list')
.removeAttr('disabled')
.removeAttr('autocomplete')
.removeData('spinner')
@@ -251,6 +253,9 @@ $.widget('ui.spinner', { .siblings()
.remove()
.end()
+ .children()
+ .removeClass('ui-spinner-listitem')
+ .end()
.parent()
.removeClass('ui-spinner ui-spinner-disabled')
.before(this.element.clone())
|