1jQuery(function ($) { 2 $(document).ready(function () { 3 //SCROLL 4 $(window).scroll(function () { 5 var scroll = $(window).scrollTop(); 6 if (scroll >= 50) { 7 $("header#header").addClass("nav-fixed"); 8 } else { 9 $("header#header").removeClass("nav-fixed"); 10 } 11 }); 12 13 //mascaras input telefone 14 if ($(".phone").length > 0) { 15 var SPMaskBehavior = function (val) { 16 return val.replace(/\D/g, "").length === 11 17 ? "(00) 00000-0000" 18 : "(00) 0000-00009"; 19 }; 20 21 var spOptions = { 22 onKeyPress: function (val, e, field, options) { 23 field.mask(SPMaskBehavior.apply({}, arguments), options); 24 }, 25 }; 26 27 $(".phone").mask(SPMaskBehavior, spOptions); 28 } 29 30 // Verifica se é um dispositivo móvel 31 function isMobile() { 32 return window.innerWidth <= 992; // ou o breakpoint que você usa para mobile 33 } 34 35 $('.nav-item.dropdown').each(function () { 36 var $dropdown = $(this); 37 var $toggle = $dropdown.find('.nav-link'); 38 var $menu = $dropdown.find('.dropdown-menu'); 39 40 if (isMobile()) { 41 // Para mobile: comportamento de clique 42 $toggle.attr('data-toggle', 'dropdown'); 43 $toggle.on('click', function (e) { 44 e.preventDefault(); 45 $menu.toggleClass('show'); 46 $dropdown.toggleClass('show'); 47 $toggle.attr('aria-expanded', function (i, attr) { 48 return attr === 'true' ? 'false' : 'true'; 49 }); 50 }); 51 52 // Fechar ao clicar fora 53 $(document).on('click', function (e) { 54 if (!$dropdown.is(e.target) && $dropdown.has(e.target).length === 0) { 55 $menu.removeClass('show'); 56 $dropdown.removeClass('show'); 57 $toggle.attr('aria-expanded', 'false'); 58 } 59 }); 60 } 61 // Para desktop mantém o comportamento hover padrão via CSS 62 }); 63 64 // Atualizar no redimensionamento da tela 65 $(window).on('resize', function () { 66 $('.dropdown-menu').removeClass('show'); 67 $('.nav-item.dropdown').removeClass('show'); 68 $('.nav-link').attr('aria-expanded', 'false'); 69 }); 70 71 }); 72 73 74}); 75 76const btn1 = document.getElementById('btn-opcao-1'); 77const btn2 = document.getElementById('btn-opcao-2'); 78const prices = document.querySelectorAll('.new-price'); 79const toggleBg = document.querySelector('.toggle-bg'); 80const badges = document.querySelectorAll('.price-wrapper .badge'); // ⬠todos os badges de desconto 81 82function ativarOpcao(btnAtivo, btnInativo, opcao) { 83 btnAtivo.classList.add('active'); 84 btnInativo.classList.remove('active'); 85 86 // Move o fundo 87 toggleBg.style.transform = opcao === 1 ? 'translateX(0%)' : 'translateX(100%)'; 88 89 // Atualiza preços 90 prices.forEach(price => { 91 price.textContent = price.getAttribute(`data-opcao-${opcao}`); 92 }); 93 94 // Atualiza badges 95 const desconto = opcao === 1 ? '30% OFF' : '50% OFF'; 96 97 badges.forEach(badge => { 98 badge.textContent = desconto; 99 }); 100} 101 102if (btn1 || btn2){ 103 btn1.addEventListener('click', () => ativarOpcao(btn1, btn2, 1)); 104 btn2.addEventListener('click', () => ativarOpcao(btn2, btn1, 2)); 105}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.