Widget:GF立绘切换:修订间差异
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<script> | |||
(function() { | (function() { | ||
var containers = document.querySelectorAll('.infotemplatebox'); | |||
containers.forEach(function(container) { | |||
var tabs = container.querySelectorAll('.gf-tab'); | |||
var slides = container.querySelectorAll('.gf-slide'); | |||
if (tabs.length === 0 || slides.length === 0) return; | |||
tabs.forEach(function(tab) { | |||
tab.addEventListener('click', function() { | |||
var index = parseInt(this.getAttribute('data-index')); | |||
tabs.forEach(function(t) { t.classList.remove('active'); }); | |||
slides.forEach(function(s) { s.classList.remove('active'); }); | |||
this.classList.add('active'); | |||
if (slides[index]) { | |||
slides[index].classList.add('active'); | |||
} | |||
}); | |||
}); | |||
}); | |||
})(); | |||
</script> | |||
})(); | |||
</script | |||
2026年5月15日 (五) 11:16的版本
<script> (function() { var containers = document.querySelectorAll('.infotemplatebox'); containers.forEach(function(container) { var tabs = container.querySelectorAll('.gf-tab'); var slides = container.querySelectorAll('.gf-slide'); if (tabs.length === 0 || slides.length === 0) return; tabs.forEach(function(tab) { tab.addEventListener('click', function() { var index = parseInt(this.getAttribute('data-index')); tabs.forEach(function(t) { t.classList.remove('active'); }); slides.forEach(function(s) { s.classList.remove('active'); }); this.classList.add('active'); if (slides[index]) { slides[index].classList.add('active'); } }); }); }); })(); </script>