편집 요약 없음 |
편집 요약 없음 태그: 되돌려진 기여 |
||
| 9번째 줄: | 9번째 줄: | ||
$('.custom-toggle').click(function() { | $('.custom-toggle').click(function() { | ||
$(this).next('.custom-content').slideToggle(); | $(this).next('.custom-content').slideToggle(); | ||
}); | |||
}); | |||
document.addEventListener("DOMContentLoaded", function() { | |||
var foldableHeaders = document.querySelectorAll('.foldable-header'); | |||
foldableHeaders.forEach(function(header) { | |||
header.addEventListener('click', function() { | |||
var content = this.nextElementSibling; | |||
if (content.style.display === 'none' || content.style.display === '') { | |||
content.style.display = 'block'; | |||
this.innerHTML = '[ 접기 ]'; // 접기 상태 텍스트 | |||
} else { | |||
content.style.display = 'none'; | |||
this.innerHTML = '[ 펼치기 ]'; // 펼치기 상태 텍스트 | |||
} | |||
}); | |||
}); | }); | ||
}); | }); | ||
2024년 9월 27일 (금) 08:51 판
/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. */
/* ReferenceTooltip 스크립트 로드 */
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-referenceTooltips.js&action=raw&ctype=text/javascript');
// jQuery를 사용하여 접기/펼치기 기능 추가
$(document).ready(function() {
// .custom-toggle를 클릭하면 다음 형제 요소(.custom-content)가 접히고 펼쳐짐
$('.custom-toggle').click(function() {
$(this).next('.custom-content').slideToggle();
});
});
document.addEventListener("DOMContentLoaded", function() {
var foldableHeaders = document.querySelectorAll('.foldable-header');
foldableHeaders.forEach(function(header) {
header.addEventListener('click', function() {
var content = this.nextElementSibling;
if (content.style.display === 'none' || content.style.display === '') {
content.style.display = 'block';
this.innerHTML = '[ 접기 ]'; // 접기 상태 텍스트
} else {
content.style.display = 'none';
this.innerHTML = '[ 펼치기 ]'; // 펼치기 상태 텍스트
}
});
});
});