Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- window.addEventListener('DOMContentLoaded', () => {
- const container = document.getElementById('attribute_pa_wersja-okleiny');
- if (!container)
- return;
- const standard = document.getElementById('attribute_pa_dekor-jednobarwny');
- if (!standard)
- return;
- const premium = document.getElementById('attribute_pa_dekor-jednobarwny-premium');
- if (!premium)
- return;
- const drewno = document.getElementById('attribute_pa_dekor-drewnopodobny');
- if (!drewno)
- return;
- const st = standard.closest('tr');
- const pr = premium.closest('tr');
- const dr = drewno.closest('tr');
- if (!st)
- return;
- if (!pr)
- return;
- if (!dr)
- return;
- standard.style.backgroundColor = "#ebedec";
- pr.style.display = "none";
- dr.style.display = "none";
- container.addEventListener('click', (e) => {
- const tgt = e.target.closest('span.swatch');
- if (!tgt)
- return; // not a swatch
- if (tgt.matches('.swatch-dekor-jednobarwny')) {
- st.removeAttribute("style");
- pr.style.display = "none";
- dr.style.display = "none";
- standard.style.backgroundColor = "#ebedec";
- } else if (tgt.matches('.swatch-dekor-jednobarwny-premium')) {
- pr.removeAttribute("style");
- st.style.display = "none";
- dr.style.display = "none";
- premium.style.backgroundColor = "#ebedec";
- } else if (tgt.matches('.swatch-dekor-drewnopodobny')) {
- dr.removeAttribute("style");
- st.style.display = "none";
- pr.style.display = "none";
- drewno.style.backgroundColor = "#ebedec";
- }
- });
- });
- </script>
- <script type="text/javascript">
- window.addEventListener('DOMContentLoaded', () => {
- const wersjaokleiny = document.getElementById('attribute_pa_wersja-okleiny');
- wersjaokleiny.addEventListener('click', (e) => {
- const wo = e.target.closest('span.swatch');
- if (!wo) return;
- const dj = document.getElementById('attribute_pa_dekor-jednobarwny');
- const djp = document.getElementById('attribute_pa_dekor-jednobarwny-premium');
- const dd = document.getElementById('attribute_pa_dekor-drewnopodobny');
- if (wo.matches('.swatch-dekor-jednobarwny-premium')) {
- const clodj = dj.closest('span.selected');
- console.log(clodj.textContent, 'klik1');
- const clodd = dd.closest('span.selected');
- clodj.classList.remove('selected');
- clodd.classList.remove('selected');
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement