var interval; $(function(){ // abre e fecha o menu $('#openmenu').click(function(){ $('nav').toggleClass('open'); }); $('nav').click(function(e){ if(!$(e.target).closest("#menu").length) $('nav').toggleClass('open'); }); $('nav').on('click', '#menu a', function(e){ $('nav').toggleClass('open'); }); // $('.post').validate(); $('.validate').validate(); setTelefone('.telefone'); $('.data').mask('99/99/9999'); $('#response').click(function(){ $(this).slideUp('fast'); }); /* // slider var loop = $("#slider .item").length >= 2 ? true : false; var owl = $("#slider").owlCarousel({ items: 1, loop: loop, dots: false, autoplay: loop, autoplayTimeout: 7000, autoplayHoverPause: false, animateIn: 'fadeIn', animateOut: 'fadeOut', }); owl.on('translate.owl.carousel', function() { $("#slider .item .b").addClass('hidden').removeClass('fadeIn'); }); owl.on('translated.owl.carousel', function() { $("#slider .active .item .b").removeClass('hidden').addClass('fadeIn'); }); // */ /* navegação */ /* var $main = $("#conteudo"), init = function() { $('#loading').fadeIn('fast'); }, loadPage = function(href){ $('title').remove(); $.post('inc_conteudo.php?meio='+href, function(response){ $main.html(response); $('#loading').fadeOut('fast'); $scroll = href == "./" ? $('#geral') : $('.scroll'); $('html, body').animate({ scrollTop: $scroll.position().top }, 150); $main.hide().fadeIn(700); document.title = $(document).find('title').text(); }).fail(function() { $('#loading').fadeOut('fast'); }); }; $(window).on("popstate", function(e) { if(e.originalEvent.state !== null) loadPage(location.href); }); $(document).on("click", "a:not([rel=ajax], .disabled, .jmodal, .noajax, .fc-event)", function() { var href = $(this).attr("href"); var url = $(this).data('url') ? $(this).data('url')+'/'+$(this).attr("href") : $(this).attr("href"); if (href.indexOf(document.domain) > -1 || href.indexOf(':') === -1){ init(); history.pushState({}, '', href); loadPage(url); return false; } }); */ /**/ }); 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'); }