Skip to content
Permalink
Browse files

Spinner: For DOM based spinners, the height is now calculated based o…

…n number of children.
  • Loading branch information
Ca-Phun Ung
Ca-Phun Ung committed Aug 30, 2008
1 parent 66d90af commit 9248368f20005c2f5a10b677dc3c07e7d996577b
Showing with 19 additions and 21 deletions.
  1. +3 −9 tests/visual/spinner.html
  2. +16 −12 ui/ui.spinner.js
@@ -10,7 +10,7 @@

<script type="text/javascript">
$(function(){

var opts = {
's1': {},
's2': {stepping: 0.25},
@@ -31,6 +31,7 @@
</script>

<style type="text/css">

body
{
background: #fff;
@@ -96,13 +97,7 @@
background: #FEFEFE;
}

.ui-spinner-list {
height: 1.2em;
line-height: 1.2em;
margin: 0;
padding: 0;
}

.ui-spinner-list,
.ui-spinner-listitem {
margin: 0;
padding: 0;
@@ -186,6 +181,5 @@ <h1>jQuery UI Spinner Test Page</h1>

<hr />


</body>
</html>
@@ -24,15 +24,6 @@ $.widget('ui.spinner', {
this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
}

// data list: set contraints to object length and step size
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 = $('>*', this.element).length-1;
}

//Initialize needed constants
var self = this;
this.element
@@ -122,9 +113,22 @@ $.widget('ui.spinner', {
})
.end();

// data list: fix height of data list spinner
if (this.element.hasClass('ui-spinner-list')) {
this.element.parent().css('height', this.element.outerHeight());
// DataList: Set contraints for object length and step size.
// Manipulate height of spinner.
this._items = this.element.children().length;
if (this._items > 1) {
this.element
.addClass('ui-spinner-list')
.css('height', this.element.outerHeight()/this._items)
.children()
.addClass('ui-spinner-listitem')
.end()
.parent()
.css('height', this.element.outerHeight())
.end();
this.options.stepping = 1;
this.options.min = 0;
this.options.max = this._items-1;
}

this.element

0 comments on commit 9248368

Please sign in to comment.
You can’t perform that action at this time.