Permalink
Browse files

Merge pull request #4314 from jasondscott/responsiveCollapible

Fixes #4220 - Collapsible - add active state on tap
  • Loading branch information...
2 parents 5ee7b0f + 90dbbfe commit 3169b0df80e06291875d499857139e8ab9f52ac0 @gseguin gseguin committed May 10, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 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();
});
}
});

0 comments on commit 3169b0d

Please sign in to comment.