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