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
@ -10,7 +10,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
|
||||
var opts = {
|
||||
's1': {},
|
||||
's2': {stepping: 0.25},
|
||||
@ -31,6 +31,7 @@ $(function(){
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body
|
||||
{
|
||||
background: #fff;
|
||||
@ -96,13 +97,7 @@ label {
|
||||
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 @@ label {
|
||||
|
||||
<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
|
||||
|
Loading…
Reference in New Issue
Block a user