mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-18 03:41:50 +00:00
20 lines
554 B
JavaScript
20 lines
554 B
JavaScript
function bindClick( collHeading, collSection, i, j ) {
|
|
return function () {
|
|
j = i + 1;
|
|
this.classList.toggle( 'section-heading--collapsed' );
|
|
collSection[ j ].classList.toggle( 'section-collapsible--collapsed' );
|
|
};
|
|
}
|
|
|
|
function main() {
|
|
var collHeading = document.getElementsByClassName( 'section-heading' ),
|
|
collSection = document.getElementsByClassName( 'section-collapsible' ),
|
|
i, j;
|
|
|
|
for ( i = 0; i < collHeading.length; i++ ) {
|
|
collHeading[ i ].addEventListener( 'click', bindClick( collHeading, collSection, i, j ) );
|
|
}
|
|
}
|
|
|
|
main();
|