편집 요약 없음 |
편집 요약 없음 |
||
| 7번째 줄: | 7번째 줄: | ||
console.log("Common.js 불러옴!"); | console.log("Common.js 불러옴!"); | ||
// 펼치기/접기 스크립트 | |||
document.addEventListener("DOMContentLoaded", function() { | document.addEventListener("DOMContentLoaded", function() { | ||
document.querySelectorAll( | var toggles = document.querySelectorAll(".toggleBtn"); | ||
toggles.forEach(function(toggle) { | |||
toggle.addEventListener("click", function() { | |||
var targetId = | var targetId = toggle.getAttribute("data-target"); | ||
var target = document.getElementById(targetId); | var target = document.getElementById(targetId); | ||
if (!target) return; | if (!target) return; | ||
if (target.style.display === | if (target.style.display === "none" || target.style.display === "") { | ||
target.style.display = | target.style.display = "block"; | ||
} else { | } else { | ||
target.style.display = | target.style.display = "none"; | ||
} | } | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
/* DO NOT ADD CODE BELOW THIS LINE */ | /* DO NOT ADD CODE BELOW THIS LINE */ | ||
2025년 4월 27일 (일) 17:19 기준 최신판
/**
* 이 스크립트는 위키백과 전체에 적용됩니다. 고칠 때는 주의해주세요.
* [[위키백과:위키프로젝트 시스템]] 참고
*
* 스크립트를 넣을 때는 충분한 설명, 출처를 넣어주세요! 이후 관리가 어려워집니다.
**/
console.log("Common.js 불러옴!");
// 펼치기/접기 스크립트
document.addEventListener("DOMContentLoaded", function() {
var toggles = document.querySelectorAll(".toggleBtn");
toggles.forEach(function(toggle) {
toggle.addEventListener("click", function() {
var targetId = toggle.getAttribute("data-target");
var target = document.getElementById(targetId);
if (!target) return;
if (target.style.display === "none" || target.style.display === "") {
target.style.display = "block";
} else {
target.style.display = "none";
}
});
});
});
/* DO NOT ADD CODE BELOW THIS LINE */