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

Commit 276f27f

Browse files
committed
Fixed missing top corner on collapsible set with only one collapsible
1 parent 3ecbf8e commit 276f27f

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

js/jquery.mobile.collapsible.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,6 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
3535

3636
// If we are in a collapsible set
3737
if ( collapsibleSet.length ) {
38-
39-
// Initialize the collapsible set if it's not already initialized
40-
if ( !collapsibleSet.jqmData( "collapsiblebound" ) ) {
41-
42-
collapsibleSet
43-
.jqmData( "collapsiblebound", true )
44-
.bind( "expand", function( event ) {
45-
46-
$( event.target )
47-
.closest( ".ui-collapsible" )
48-
.siblings( ".ui-collapsible" )
49-
.trigger( "collapse" );
50-
51-
});
52-
}
53-
54-
colllapsiblesInSet.first()
55-
.find( "a:eq(0)" )
56-
.addClass( "ui-corner-top" )
57-
.find( ".ui-btn-inner" )
58-
.addClass( "ui-corner-top" );
59-
60-
colllapsiblesInSet.last()
61-
.jqmData( "collapsible-last", true )
62-
.find( "a:eq(0)" )
63-
.addClass( "ui-corner-bottom" )
64-
.find( ".ui-btn-inner" )
65-
.addClass( "ui-corner-bottom" );
66-
6738
// Inherit the theme from collapsible-set
6839
if ( !o.theme ) {
6940
o.theme = collapsibleSet.jqmData( "theme" );
@@ -97,6 +68,37 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
9768
.find( "a:eq(0), .ui-btn-inner" )
9869
.addClass( "ui-corner-top ui-corner-bottom" );
9970
} else {
71+
// If we are in a collapsible set
72+
73+
// Initialize the collapsible set if it's not already initialized
74+
if ( !collapsibleSet.jqmData( "collapsiblebound" ) ) {
75+
76+
collapsibleSet
77+
.jqmData( "collapsiblebound", true )
78+
.bind( "expand", function( event ) {
79+
80+
$( event.target )
81+
.closest( ".ui-collapsible" )
82+
.siblings( ".ui-collapsible" )
83+
.trigger( "collapse" );
84+
85+
});
86+
}
87+
88+
colllapsiblesInSet.first()
89+
.find( "a:eq(0)" )
90+
.addClass( "ui-corner-top" )
91+
.find( ".ui-btn-inner" )
92+
.addClass( "ui-corner-top" );
93+
94+
colllapsiblesInSet.last()
95+
.jqmData( "collapsible-last", true )
96+
.find( "a:eq(0)" )
97+
.addClass( "ui-corner-bottom" )
98+
.find( ".ui-btn-inner" )
99+
.addClass( "ui-corner-bottom" );
100+
101+
100102
if ( collapsible.jqmData( "collapsible-last" ) ) {
101103
collapsibleHeading
102104
.find( "a:eq(0), .ui-btn-inner" )

0 commit comments

Comments
 (0)