mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Spinner: For DOM based spinners, the height is now calculated based on number of children.
This commit is contained in:
parent
66d90af241
commit
9248368f20
@ -31,6 +31,7 @@ $(function(){
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
background: #fff;
|
background: #fff;
|
||||||
@ -96,13 +97,7 @@ label {
|
|||||||
background: #FEFEFE;
|
background: #FEFEFE;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-spinner-list {
|
.ui-spinner-list,
|
||||||
height: 1.2em;
|
|
||||||
line-height: 1.2em;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-spinner-listitem {
|
.ui-spinner-listitem {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@ -186,6 +181,5 @@ label {
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -24,15 +24,6 @@ $.widget('ui.spinner', {
|
|||||||
this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
|
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
|
//Initialize needed constants
|
||||||
var self = this;
|
var self = this;
|
||||||
this.element
|
this.element
|
||||||
@ -122,9 +113,22 @@ $.widget('ui.spinner', {
|
|||||||
})
|
})
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
// data list: fix height of data list spinner
|
// DataList: Set contraints for object length and step size.
|
||||||
if (this.element.hasClass('ui-spinner-list')) {
|
// Manipulate height of spinner.
|
||||||
this.element.parent().css('height', this.element.outerHeight());
|
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
|
this.element
|
||||||
|
Loading…
Reference in New Issue
Block a user