Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit dab9bf9

Browse files
author
Gabriel Schulhof
committed
[controlgroup] Re-introduce refresh() method, to mark first and last visible child
1 parent fab9b3f commit dab9bf9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

js/widgets/controlgroup.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ define( [ "jquery",
4343
self.options[ key ] = undefined;
4444
self._setOption( key, value, true );
4545
});
46+
47+
this._refresh( true );
4648
},
4749

4850
_setOption: function( key, value ) {
@@ -76,6 +78,21 @@ define( [ "jquery",
7678

7779
container: function() {
7880
return this.element.children( ".ui-controlgroup-controls" );
81+
},
82+
83+
_refresh: function( create ) {
84+
var els = this.element.find( ".ui-btn" ).not( ".ui-slider-handle" );
85+
86+
els.removeClass( "ui-first-child ui-last-child" );
87+
if ( !create && this.options.excludeInvisible ) {
88+
els = els.filter( ":visible" );
89+
}
90+
91+
els.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" );
92+
},
93+
94+
refresh: function() {
95+
this._refresh( false );
7996
}
8097
});
8198

0 commit comments

Comments
 (0)