var interval; $(function(){ // abre e fecha o menu $('#menu_mobile .openmenu').click(function(){ $('nav').toggleClass('open'); }); $('#menu_mobile nav').click(function(e){ if(!$(e.target).closest("#menu_mobile ul").length) $('#menu_mobile nav').toggleClass('open'); }); $('#menu_mobile nav').on('click', 'a', function(e){ $('#menu_mobile nav').toggleClass('open'); }); // setTelefone('.telefone'); $('.data').mask('99/99/9999'); setMaskCPF('.cpf'); $('#response').click(function(){ $(this).slideUp('fast'); }); // slider var loop = $("#slider .item").length >= 2 ? true : false; $("#slider").owlCarousel({ items: 1, loop: loop, dots: false, autoplay: loop, autoplayTimeout: 7000, autoplayHoverPause: false, animateIn: 'fadeIn', animateOut: 'fadeOut', }); // // $('.social .item').on('mouseover', function(){ let _th = $(this); let bgColor = _th.data('bgcolor'); let color = _th.data('color'); let bgColorAtual = _th.css('background-color'); let colorAtual = _th.find('a').css('color'); if(bgColor){ _th.attr('data-atualbgcolor', bgColorAtual); _th.attr('data-atualcolor', colorAtual); _th.css({'background-color':bgColor}); _th.find('a').css({'color':color}); } }); $('.social .item').on('mouseout', function(){ let _th = $(this); let bgColorAtual = _th.data('atualbgcolor'); let colorAtual = _th.data('atualcolor'); _th.css({'background-color':bgColorAtual}); _th.find('a').css({'color':colorAtual}); }); // // scroll $('.scroll').on('click', this, function(e){ e.preventDefault(); let _th = $(this); let rol = _th.data('rol'); var position_stage = rol && $('#'+rol).position() ? parseFloat($('#'+rol).position().top) : 0; if(!position_stage){ document.location.href = `./#${rol}`; return; } $('html, body').animate({ scrollTop: position_stage }, 150); }); // $('#logout').click(function(e){ e.preventDefault(); if(confirm('Confirma o logout do sistema?')){ $.post('logar.php', {funcao:'logout'}, function(d){ $('#response').html(d); }); } }); }); function setTelefone(element){ $(element).focusout(function(){ var phone, element; element = $(this); element.unmask(); phone = element.val().replace(/\D/g, ''); if(phone.length > 10) { element.mask("(99)99999-999?9"); } else { element.mask("(99)9999-9999?9"); } }).trigger('focusout'); } function openResponse(camada, data){ clearTimeout(interval); camada = camada.replace(/#/, ''); camada = '#'+camada; //$(camada).slideUp('fast'); $(camada).html(data); $(camada).slideDown('slow'); interval = setTimeout(function(){ $(camada).slideUp('slow'); }, 5000); }