Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #4220 - Collapsible - add active state on tap

Fixes: #4220
How fixed: Added the active button state on tap of a collapsible heading
How Tested: Docs and http://jsbin.com/omacox/100
  • Loading branch information...
commit 90dbbfe88609efcd5b6008a1c597ddc7d29a7ff4 1 parent 504fe1a
Jason Scott authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 js/jquery.mobile.collapsible.js
View
8 js/jquery.mobile.collapsible.js
@@ -107,7 +107,9 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
.end()
.find( ".ui-icon" )
.toggleClass( "ui-icon-" + expandedIcon, !isCollapse )
- .toggleClass( "ui-icon-" + collapsedIcon, isCollapse );
+ .toggleClass( "ui-icon-" + collapsedIcon, isCollapse )
+ .end()
+ .find( "a" ).first().removeClass( $.mobile.activeBtnClass );
$this.toggleClass( "ui-collapsible-collapsed", isCollapse );
collapsibleContent.toggleClass( "ui-collapsible-content-collapsed", isCollapse ).attr( "aria-hidden", isCollapse );
@@ -124,6 +126,9 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
.trigger( o.collapsed ? "collapse" : "expand" );
collapsibleHeading
+ .bind( "tap", function( event ) {
+ collapsibleHeading.find( "a" ).first().addClass( $.mobile.activeBtnClass );
+ })
.bind( "click", function( event ) {
var type = collapsibleHeading.is( ".ui-collapsible-heading-collapsed" ) ?
@@ -132,6 +137,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsible.trigger( type );
event.preventDefault();
+ event.stopPropagation();
});
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.