(Created page with "→************************************************* /* Responsive Flex Passage Mobile Collapse Script * /*************************************************: // Author: Shawn...") |
No edit summary |
||
Line 17: | Line 17: | ||
if ( heading.length > 0 ) { |
if ( heading.length > 0 ) { |
||
$( this ).addClass( "rfpmobilecollapsible" + index ); |
$( this ).addClass( "rfpmobilecollapsible" + index ); |
||
− | if ( !$( this ).hasClass( ' |
+ | if ( !$( this ).hasClass( 'collapsed' ) ) { |
− | $( this ).addClass( " |
+ | $( this ).addClass( "expanded" ); |
} |
} |
||
heading.html( $( '<a href="javascript:rfpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) ); |
heading.html( $( '<a href="javascript:rfpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) ); |
Latest revision as of 01:32, 7 March 2021
/**************************************************
/* Responsive Flex Passage Mobile Collapse Script *
/**************************************************/
// Author: Shawn Bruckner
// Date: 2019-Jun-09
// License: CC-BY 3.0
// Version: 1.0
// This script enables the mobile collapse features of responsive flex passages
// See Template:RFP block for more information.
var rfpmobilecollapse = rfpmobilecollapse || {
initialize : function() {
var index = 0;
$( ".rfpblock.rfpmobilecollapsible" ).each( function() {
var heading = $( this ).find( ".heading" )
if ( heading.length > 0 ) {
$( this ).addClass( "rfpmobilecollapsible" + index );
if ( !$( this ).hasClass( 'collapsed' ) ) {
$( this ).addClass( "expanded" );
}
heading.html( $( '<a href="javascript:rfpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) );
}
++index;
} );
},
toggle : function( index ) {
$( ".rfpblock.rfpmobilecollapsible" + index ).each( function() {
if ( $( this ).hasClass( 'collapsed' ) ) {
$( this ).removeClass( 'collapsed' );
$( this ).addClass( 'expanded' );
} else {
$( this ).removeClass( 'expanded' );
$( this ).addClass( 'collapsed' );
}
} );
}
}
window.rfpmobilecollapse = rfpmobilecollapse;
$( document ).ready( rfpmobilecollapse.initialize );
/******************************************************
/* End Responsive Flex Passage Mobile Collapse Script *
/******************************************************/