1'use strict'; 2 3 4jQuery( document ).ready(function($) { 5 6 var menuAberto = false; 7 var menuSticky = false; 8 var submenuAberto = false; 9 var urlLightbox; 10 11 12 $(".menu-principal .sub>a").click(function (event) { 13 //event.preventDefault(); 14 }); 15 16 17 if($(window).width()<770) { //abre submenu em celulares 18 19 $(".menu-principal .sub").click(function () { 20 if(submenuAberto === false) { 21 $(this).children('.sub-menu').slideDown(150); 22 $(this).addClass('ativo'); 23 submenuAberto = true; 24 } else { 25 if($(this).hasClass('ativo')) { 26 $(this).removeClass('ativo'); 27 $(this).children('.sub-menu').slideUp(150); 28 submenuAberto = false; 29 } else { 30 $(".menu-principal .sub").children('.sub-menu').slideUp(150); 31 $(".menu-principal .sub").removeClass('ativo'); 32 $(this).children('.sub-menu').slideDown(150); 33 $(this).addClass('ativo'); 34 submenuAberto = true; 35 } 36 } 37 38 }); 39 40 $(".nav-menu").click(function () { 41 if(menuAberto===false) { 42 $(".menu-principal").addClass('aberto'); 43 $(".nav-menu").addClass('desativa'); 44 menuAberto = true; 45 } else { 46 $(".menu-principal").removeClass('aberto'); 47 $(".nav-menu").removeClass('desativa'); 48 menuAberto = false; 49 } 50 51 }); 52 53 $(".bt-fechar-menu").click(function () { 54 $(".menu-principal").removeClass('aberto'); 55 $(".nav-menu").removeClass('desativa'); 56 menuAberto = false; 57 }); 58 59 } else { //abre submenu em desktops 60 61 $(".menu-principal .sub").hover(function () { 62 $(this).children('.sub-menu').fadeToggle(150); 63 }); 64 65 } 66 67 //abre busca 68 $(".busca-bt").click(function () { 69 $('#busca').slideToggle(300); 70 $(this).blur(); 71 $('#busca input[type="search"]').focus(); 72 }); 73 74 //durante o scroll - esconde o menu em celulares e controla o menu sticky 75 $(window).scroll(function() { 76 $('.menu-principal').removeClass('aberto'); 77 $(".nav-menu").removeClass('desativa'); 78 menuAberto = false; 79 80 //STICKY MENU DESKTOP 81 if ($(window).scrollTop()>$(window).height()/5) { 82 $('nav.barra.menu').addClass('pre-sticky'); 83 setTimeout(function(){$('nav.barra.menu').addClass('sticky');},50); 84 menuSticky = true; 85 } else { 86 $('nav.barra.menu').removeClass('sticky'); 87 $('nav.barra.menu').removeClass('pre-sticky'); 88 menuSticky = false; 89 } 90 91 if($(window).width()<767) { 92 menuSticky = false; 93 } 94 95 }); 96 97 //controles lightbox 98 $(".lightbox").click(function () { 99 $(this).fadeOut(300); 100 urlLightbox = $(this).find('iframe').attr('src'); 101 $(this).find('iframe').attr('src', null); 102 $(this).find('iframe').css('opacity', 0); 103 $(this).find('iframe').attr('src', urlLightbox); 104 }); 105 106 $(".abre-lightbox").click(function () { 107 var target = $(this).attr('data-lightbox'); 108 $('#'+target).fadeIn(300); 109 $('#'+target+' iframe').css('opacity', 1); 110 111 }); 112 113 $(".mensagemaviso").fadeOut(); 114 $(".mensagemaviso").click(function () { 115 $(this).fadeOut(); 116 }); 117 118 119}); 120 121(function ($) { 122 $.mensagem = { 123 _class: "mensagemavisobox", 124 _timeRemove: 300, 125 _timeFadeout: 5000, 126 127 fixed: function () { 128 this._timeRemove = 999999999; 129 this._timeFadeout= 999999999; 130 return this; 131 }, 132 alerta: function (texto) { 133 if ($(".mensagemavisobox").length == 0) { 134 var box = $("<div class=\"" + this._class + "\"></div>"); 135 var element = $("<div class=\"mensagemalerta\"></div>"); 136 box.append(element); 137 } else { 138 var box = $(".mensagemavisobox"); 139 var element = $(".mensagemalerta"); 140 } 141 this._animation(box, element, texto); 142 return this; 143 }, 144 sucesso: function (texto) { 145 if ($(".mensagemavisobox").length == 0) { 146 var box = $("<div class=\"" + this._class + "\"></div>"); 147 var element = $("<div class=\"mensagemsucesso\"></div>"); 148 box.append(element); 149 } else { 150 var box = $(".mensagemavisobox"); 151 var element = $(".mensagemalerta"); 152 } 153 this._animation(box, element, texto); 154 return this; 155 }, 156 157 _animation: function (box, element, texto) { 158 box.append(element); 159 $("body").append(box); 160 element.html(texto); 161 element.fadeIn(300); 162 var t = this; 163 var to = setTimeout(function () { 164 element.fadeOut(300);
165 t._remove(element, t); 166 }, this._timeFadeout); 167 element.click(function () { clearTimeout(to); $(this).fadeOut(300); t._remove(element, t); }); 168 }, 169 _remove: function (element, t) { 170 setTimeout(function () { element.parent().remove(); }, t._timeRemove); 171 } 172 } 173})(jQuery); 174 175 176
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.