Mudanças entre as edições de "Widget:Teste"
Ir para navegação
Ir para pesquisar
| Linha 6: | Linha 6: | ||
<script> | <script> | ||
document.addEventListener("DOMContentLoaded", function () { | (function () { | ||
document.addEventListener("DOMContentLoaded", function () { | |||
var tabs = document.querySelectorAll('.skillbox-tab'); | |||
var panels = document.querySelectorAll('.skillbox-panel'); | |||
for (var i = 0; i < tabs.length; i++) { | |||
(function (index) { | |||
tabs[index].addEventListener('click', function () { | |||
// remove todos os ativos | |||
for (var j = 0; j < tabs.length; j++) { | |||
tabs[j].classList.remove('active'); | |||
panels[j].classList.remove('active'); | |||
} | |||
// ativa o atual | |||
tabs[index].classList.add('active'); | |||
panels[index].classList.add('active'); | |||
// pausa todos os vídeos e toca o atual | |||
for (var k = 0; k < panels.length; k++) { | |||
var v = panels[k].querySelector('video'); | |||
if (v) v.pause(); | |||
if ( | } | ||
var current = panels[index].querySelector('video'); | |||
if (current) { | |||
current.load(); | |||
current.play(); | |||
} | |||
}); | }); | ||
})(i); | |||
} | |||
} | |||
}); | }); | ||
}); | })(); | ||
</script> | </script> | ||
Edição das 03h06min de 23 de maio de 2025
<style> .skillbox-video {
aspect-ratio: 16 / 9;
} </style>
<script> (function () {
document.addEventListener("DOMContentLoaded", function () {
var tabs = document.querySelectorAll('.skillbox-tab');
var panels = document.querySelectorAll('.skillbox-panel');
for (var i = 0; i < tabs.length; i++) {
(function (index) {
tabs[index].addEventListener('click', function () {
// remove todos os ativos
for (var j = 0; j < tabs.length; j++) {
tabs[j].classList.remove('active');
panels[j].classList.remove('active');
}
// ativa o atual
tabs[index].classList.add('active');
panels[index].classList.add('active');
// pausa todos os vídeos e toca o atual
for (var k = 0; k < panels.length; k++) {
var v = panels[k].querySelector('video');
if (v) v.pause();
}
var current = panels[index].querySelector('video');
if (current) {
current.load();
current.play();
}
});
})(i);
}
});
})(); </script>