jQuery( function( $ ) { var $btn_menu = $("#icono-menu-responsive"); var $menu = $("#menu-responsive > div > ul"); var $width = $menu.width() + 1; // BorderLeft var $menuInicio = $(".menu"); var $itemMenu = $menuInicio.find("li.menu-item-has-children"); var $itemsMenu = $("#menu-responsive .menu-item"); var $itemsSubMenu = $("#menu-responsive .menu-item .sub-item-menu"); // $(' body nav#appnav ul li ul').hover( // function(e){ $(this).parent().addClass('open') }, // function(e){ $(this).parent().removeClass('open') } // ); $('#appnav .dropdown-sectores a:not(.dropdown-toggle)').on('click', function(e){ $(this).parent().parent().parent().css('background-color', '#fff'); $(this).parent().parent().parent().find('a').css('color', '#005571'); e.preventDefault(); var sector = $(this).attr('data-sector'); localStorage.setItem('sector', sector); if($('#current-lang').val() == 'es'){ window.location.href = '/formacion'; }else{ window.location.href = '/'+$('#current-lang').val()+'/formacion-'+$('#current-lang').val(); } }); $('#appnav .dropdown-toggle-sectores').on('click', function(e){ e.preventDefault(); var page = $(this).attr('href'); window.location.href = page; }); $btn_menu.click(function(){ animIn = function () { $menu.addClass('active').show().css({ right: -($width) }).animate({ right: 0 }, 500); }; if (!$menu.hasClass('active')) { animIn(); }else{ var $pos = 0 - $width; $menu.removeClass('active').animate({ right: $pos }, 500); } }); /*$("main.main").click(function(){ console.log('click'); if ($menu.hasClass('active')) { $menu.removeClass('active').animate({ right: -$width }, 500); } });*/ $(".sub-item-menu").click(function(){ var $curr = $(this); var $ul = $curr.siblings('ul.sub-menu'); var $separator = $curr.siblings('div.separator-menu'); var $li = $curr.parent(); if($curr.hasClass('glyphicon-menu-down')){ $curr.removeClass('glyphicon-menu-down'); $curr.addClass('glyphicon-menu-left'); $ul.css('display', 'none'); $separator.css('display', 'none'); $li.removeClass('item-open'); }else{ $curr.removeClass('glyphicon-menu-left'); $curr.addClass('glyphicon-menu-down'); $ul.css('display', 'block'); $separator.css('display', 'block'); $li.addClass('item-open'); } }); $itemsSubMenu.on('click', function(e){ e.stopPropagation(); e.preventDefault(); }); $itemsMenu.on('click', function(){ var a = $(this).find('a').attr('href'); window.location.replace(a); }); $('#selector-paises-scroll').on('click', function(){ $("#paises-scroll").slideToggle('fast'); }); $(".menu li.menu-item-has-children").hover( function() { $(this).children("ul.sub-menu").css({"display": "block"}); }, function() { $(this).children("ul.sub-menu").css({"display": "none"}); } ); $('#selector-paises-scroll #paises-scroll a').on('click', function(){ $.ajax({ url: themosis.ajaxurl, type: 'POST', dataType: 'json', data: { action: 'empty-cart', } }); }); $("#paises").on('change', function(){ var pais = $(this).find('option:selected').val(); $.ajax({ url: themosis.ajaxurl, type: 'POST', dataType: 'json', data: { action: 'empty-cart', } }).done(function(data){ if( pais === 'es'){ window.location.replace('/'); }else{ window.location.replace('/'+pais+'/'); } }); }); $("#carrito-button").hover( function() { $(".dropdown-carrito").css('display', 'block'); }, function() { setTimeout(function () { $(".dropdown-carrito").css('display', 'none'); }, 300); } ); $("#see-more").on('click', function(){ $(".more-items-cart > div.item-carrito:not(:first-child)").css('display', 'block'); $(this).css('display', 'none'); $("#see-less").css('display', 'block'); }); $("#see-less").on('click', function(){ $(".more-items-cart > div.item-carrito:not(:first-child)").css('display', 'none'); $(this).css('display', 'none'); $("#see-more").css('display', 'block'); }); $('div#modalidades .button-todos').on('click', function(e){ e.preventDefault(); var index = $(this).parent().parent().parent().parent().parent().index(); switch( index ){ case 0: var modalidad = 'presencial'; break; case 1: var modalidad = 'online'; break; case 2: var modalidad = 'videoconferencia'; break; case 3: var modalidad = 'incompany'; break; } localStorage.setItem('modalidad', modalidad); if($('#current-lang').val() == 'es'){ window.location.href = '/formacion'; }else{ window.location.href = '/'+$('#current-lang').val()+'/formacion-'+$('#current-lang').val(); } }); $('.footer-2-link').on('click', function(e){ e.preventDefault(); var sector = $(this).attr('href'); localStorage.setItem('sector', sector); if($('#current-lang').val() == 'es'){ window.location = '/formacion'; }else{ window.location.href = '/'+$('#current-lang').val()+'/formacion-'+$('#current-lang').val(); } }); $('.footer-3-link').on('click', function(e){ e.preventDefault(); var modalidad = $(this).attr('href'); localStorage.setItem('modalidad', modalidad); if($('#current-lang').val() == 'es'){ window.location.href = '/formacion'; }else{ window.location.href = '/'+$('#current-lang').val()+'/formacion-'+$('#current-lang').val(); } }); }); // $("a").on("click", function(){ // if($(this).attr("href")=="tel:976275174"|| $(this).attr("href")=="tel:5585259438" || $(this).attr("href")=="tel:541139894112" || $(this).attr("href")=="tel:56229402154" || $(this).attr("href")=="tel:17075960" || $(this).attr("href")=="tel:5714898264"){ // ga('send', { // hitType: 'event', // eventCategory: 'phoneClicked-' + $("#current-lang").val(), // eventAction: "send" // }); // } else if ($(this).attr("href")=="mailto:capacitacion@tcmetrologia.com"|| $(this).attr("href")=="mailto:formacion@tcmetrologia.com"){ // ga('send', { // hitType: 'event', // eventCategory: 'mailClicked-' + $("#current-lang").val(), // eventAction: "send" // }); // } // }) // $( "body" ).on( "click", "em[unselectable] .x-btn-text:first", function() { // ga('send', { // hitType: 'event', // eventCategory: 'phoneClicked-' + $("#current-lang").val(), // eventAction: "send" // }); // }); $('div#modalidades .modalidad-buttons .button-video').on('click', function(e){ e.preventDefault() $('#modalVideo').modal('show'); });