var scrollBefore = 0; var scrollTotal = 0; var barra = 200; $(function() { var touchPos; const nav = document.querySelector(".barra-movil .navbar"); const beta = document.querySelector(".version-beta"); if($(window).width()<=991){ var lastScrollY = window.scrollY; window.addEventListener("scroll", () => { if(window.scrollY<=75){ nav.classList.remove("nav--hidden"); nav.classList.add("nav--showing"); beta.classList.remove("nav--hidden"); beta.classList.add("nav--showing"); }else{ if (lastScrollY < window.scrollY) { nav.classList.remove("nav--showing"); nav.classList.add("nav--hidden"); beta.classList.remove("nav--showing"); beta.classList.add("nav--hidden"); } else { nav.classList.remove("nav--hidden"); nav.classList.add("nav--showing"); beta.classList.remove("nav--hidden"); beta.classList.add("nav--showing"); } } lastScrollY = window.scrollY; }); } $("#accion-escribenos-movil").click(function() { $("#aside-movil").hide(); cerrarMenusInternosMovil(); $("#aside-whatsapp").fadeToggle(200); }) $("#m-close-button").click(function() { $("#accion-escribenos-movil").click(); }) $("#menu-tienda-movil").click(function() { $("#menu-mas-movil").removeClass('activo') $("#menu-cerrar-movil").removeClass('activo') $("#menu-tienda-movil").addClass('activo') $("#seccionMas").hide(); $("#seccionTienda").show(200); }); $("#menu-mas-movil").click(function() { $("#menu-tienda-movil").removeClass('activo') $("#menu-mas-movil").addClass('activo') $("#menu-cerrar-movil").addClass('activo') $("#seccionTienda").hide(); $("#seccionMas").show(200); }) $("#accion-menu-movil").click(function() { cerrarMenusInternosMovil(); $("#aside-whatsapp").hide(); $("#aside-movil").fadeToggle(300); }) $("#botonAsideMenuTop").click(function() { $("#accion-menu-movil").click() }) $("#ul-header").height($("#header-fixed").height()); $("header .nav-item").hover( function() { var headerFixed = $("#header-fixed").height(); if($(".anunciador").is(':visible')){ headerFixed = headerFixed + $(".anunciador").height(); } $(this).find(".mega-menu-header").css('top', headerFixed + "px"); $(this).find(".mega-menu-header").stop(true, true).show("slide", {direction: "up"}, 300) cerrarBuscador() }, function() { $(".nav-item").stop(true, true) $(this).find(".mega-menu-header").hide("slide", {direction: "up"}, 100) } ); $("footer .nav-item").hover( function() { $(this).find(".mega-menu").css('bottom', $("#footer-fixed").height() + "px"); $(this).find(".mega-menu").stop(true, true).show(300); }, function() { $(this).find(".mega-menu").hide(300); } ); $(".nav-item-movil").click(function() { var textoM = $(this).find('.material-icons').text(); if (textoM == 'add') { $('.material-icons').text('add'); $(this).find('.material-icons').text('remove'); $('.mega-menu').hide(300); $(this).find('.mega-menu').show(300); } else { $(this).find('.material-icons').text('add'); $(this).find('.mega-menu').hide(300); } }); $(".opcion-menu-movil").click(function() { var textoM = $(this).find('.flecha').html(); if (textoM == '') { cerrarMenusInternosMovil(); $(this).find('.flecha').find('i').removeClass('fa-angle-right'); $(this).find('.flecha').find('i').addClass('fa-angle-down'); $(this).find('.contenido-table-menu').show(200); } else { $(this).find('.flecha').find('i').removeClass('fa-angle-down'); $(this).find('.flecha').find('i').addClass('fa-angle-right'); $(this).find('.contenido-table-menu').hide(200); } }) }); function cerrarMenusInternosMovil() { $('.opcion-menu-movil .flecha').find('i').removeClass('fa-angle-down'); $('.opcion-menu-movil .flecha').find('i').addClass('fa-angle-right'); $('.opcion-menu-movil .contenido-table-menu').hide(); } function iniciarConversacionWhatsapp(){ $("#accion-escribenos-movil").click(); $("#modalWhatsapp").modal('show') }