1$(document).ready(function () { 2 $( ".cc62_navigation_menu .tab-content .tab-pane .tab-menu" ).each(function( index ) { 3 $(this).attr('data-id',index) 4 $(this).attr('id',"tab-"+index) 5 $(".block-cart",this).attr('id',"elem-"+index) 6 $(".block-cart",this).addClass("elem-"+index) 7 8 }); 9 10 $( ".cc62_navigation_menu .tab-content .tab-pane .tab-panel-level2" ).each(function( index ) { 11 $(this).attr('id',"sec-" + index) 12 }); 13 14 $(".cc62_navigation_menu .tab-content .tab-pane .tab-panel-level2").hide(); 15 16 if($(window).width() > 1024) { 17 if($('body').hasClass('xf-web-container')) { 18 $( ".cc62_navigation_menu .tab-content .tab-pane .tab-menu .block-cart" ).click(function() { 19 if($(this ).hasClass( "activeSecond" )){ 20 $(".tab-panel-level2").slideUp("fast"); 21 $('span',this).removeClass('show'); 22 $('a',this).removeClass('show'); 23 $(".icon-up",this).addClass("icon-down1"); 24 $(".icon-up",this).removeClass("icon-up"); 25 26 27 }else{ 28 setTimeout(function() { 29 $( ".block-cart" ).each(function( index ) { 30 if($(this ).hasClass( "activeSecond" )){ 31 //alert( index + ": " + $( this ).text() ); 32 $(".icon-down1",this).addClass("icon-up"); 33 $(".icon-down1",this).removeClass("icon-down1"); 34 $('span',this).addClass('show'); 35 $('a',this).addClass('show'); 36 //$(".block1",this).css("color","#0000") 37 //$(".icon",this).css("color","#0000") 38 //$(".icon-up",this).css("color","red"); 39 40 }else{ 41 $(".icon-up",this).addClass("icon-down1"); 42 $(".icon-up",this).removeClass("icon-up"); 43 $('span',this).removeClass('show'); 44 $('a',this).removeClass('show'); 45 //$(".block1",this).css("color","var(--color-primary-01)") 46 //$(".icon",this).css("color","var(--color-primary-01)") 47 } 48 49 }); 50 },100); 51 } 52 53 }); 54 $(".cc62_navigation_menu .tab-content .tab-pane .tab-menu").click(function () { 55 if(!$(this).hasClass('open')){ 56 $(".navigation_menu").css("z-index","0"); 57 $(".submenu_new").css("z-index","20"); 58 $('.submenu_new').addClass('open'); 59 $('.tab-menu').removeClass('open'); 60 $(this).addClass('open'); 61 selected = false; 62 if($(".block-cart",this).hasClass("activeSecond")){ 63 $(".block-cart",this).removeClass("activeSecond"); 64 $('.submenu_new').removeClass('open'); 65 //$(".submenu_new").css("height","160px") 66 }else{ 67 openTabSec($(this), $(this).data('id')); 68 } 69 }else { 70 $('.submenu_new').removeClass('open'); 71 $('.tab-menu').removeClass('open'); 72 $(".block-cart",this).removeClass("activeSecond"); 73 } 74 var action = 'Menu - Desktop'; 75 var label = $('a',this).text().trim(); 76 //analitycsHeaderNew(action,label); 77 }); 78 }else { 79 $(".cc62_navigation_menu .tab-content .tab-pane .tab-menu").hover(function (e) { 80 if(!$(this).hasClass('open') && $(this).hasClass('true')){ 81 $(".navigation_menu").css("z-index","0"); 82 $(".submenu_new").css("z-index","20"); 83 $('.submenu_new').addClass('open'); 84 $('.tab-menu').removeClass('open'); 85 86 $(this).addClass('open'); 87 selected = false;
88 if($(".block-cart",this).hasClass("activeSecond")){ 89 $(".block-cart",this).removeClass("activeSecond"); 90 $('.submenu_new').removeClass('open'); 91 //$(".submenu_new").css("height","160px") 92 }else{ 93 $(".icon-down1",this).addClass("icon-up"); 94 $(".icon-down1",this).removeClass("icon-down1"); 95 openTabSec($(this), $(this).data('id')); 96 } 97 98 }else { 99 $(".icon-up",this).addClass("icon-down1"); 100 $(".icon-up",this).removeClass("icon-up"); 101 //$('.submenu_new').removeClass('open'); 102 //$('.tab-menu').removeClass('open'); 103 //$(".block-cart",this).removeClass("activeSecond"); 104 } 105 var action = 'Menu - Desktop'; 106 var label = $('a',this).text().trim(); 107 analitycsHeaderNew(action,label); 108 countMouseLeave = 0; 109 }); 110 // SALE EL RATÃN DEL PRIMER NIVEL 111 $('.cc62_navigation_menu .header_new .nav-item').mouseleave(function(e) { 112 var el_pos = $(this).offset(); 113 var edge = closestEdge(e.pageX - el_pos.left, e.pageY - el_pos.top, $(this).width(), $(this).height()); 114 var $container = $(".cc62_navigation_menu .tab-content"); 115 var firstEle = $(e.target).is(':first'); 116 if(edge == 'top') { 117 mouseEnter($container,e); 118 mouseEnterCount = 1; 119 } 120 }); 121 122 $( ".cc62_navigation_menu .tab-content .tab-pane .tab-menu" ).click(function() { 123 $('a',this).click(function(e){ 124 e.preventDefault(); 125 }); 126 127 if($('a',this).attr('href')) { 128 var link = $('a',this).attr('href'); 129 var target = $('a',this).attr('target'); 130 if(target != null && target != ""){ 131 if(target == "_self"){ 132 window.location = link; 133 } 134 else if(target == "_blank"){ 135 window.open(link).focus(); 136 } 137 138 } 139 else{ 140 window.location = link; 141 } 142 143 } 144 }); 145 146 } 147 $(document).on("click", function(event){ 148 var tabMenu = $('.cc62_navigation_menu .tab-content .tab-pane .tab-menu').hasClass('open'); 149 if(!$(event.target).closest(".submenu_links").length && !$(event.target).closest(".elementos").length && !$(event.target).closest(".section-contact").length && !$(event.target).hasClass('nav-item')){ 150 $(".tab-panel-level2").slideUp("fast"); 151 152 if($('.submenu_new').hasClass('open')) { 153 $('.submenu_new').removeClass('open'); 154 $('.tab-menu').removeClass('open'); 155 $('.tab-content').slideUp(); 156 } 157 $( ".block-cart" ).each(function( index ) { 158 $(this).removeClass("activeSecond"); 159 $(".icon-up",this).addClass("icon-down1"); 160 $(".icon-up",this).removeClass("icon-up"); 161 $(".block1",this).css("color","var(--color-primary-01)") 162 $(".icon",this).css("color","var(--color-primary-01)") 163 }); 164 } 165 }); 166 } 167}); 168 169function closestEdge(x,y,w,h) { 170 var topEdgeDist = distMetric(x,y,w/2,0); 171 var bottomEdgeDist = distMetric(x,y,w/2,h); 172 var leftEdgeDist = distMetric(x,y,0,h/2); 173 var rightEdgeDist = distMetric(x,y,w,h/2); 174 175 var min = Math.min(topEdgeDist,bottomEdgeDist,leftEdgeDist,rightEdgeDist); 176 switch (min) { 177 case leftEdgeDist: 178 return "left"; 179 case rightEdgeDist: 180 return "right"; 181 case topEdgeDist: 182 return "top"; 183 case bottomEdgeDist: 184 return "bottom"; 185 } 186} 187 188 189function distMetric(x,y,x2,y2) { 190 var xDiff = x - x2; 191 var yDiff = y - y2; 192 return (xDiff * xDiff) + (yDiff * yDiff); 193} 194 195function openTabSec(clicked, cityName, event) { 196 //console.log("clicked: "+clicked) 197 //console.log("cityName: "+cityName) 198 // Declare all variables 199 var i, tabcontent, tablinks; 200 201 // Get all elements with class="tabcontent" and hide them 202 tabcontent = document.getElementsByClassName("tab-panel-level2"); 203 204 205 for (i = 0; i < tabcontent.length; i++) {
206 //console.log("tabcontent: "+tabcontent[i]) 207 tabcontent[i].style.display = "none"; 208 $(tabcontent[i]).hide() 209 } 210 211 // Get all elements with class="tablinks" and remove the class "active" 212 tablinks = document.getElementsByClassName("widget-tab"); 213 console.log("tablinks: "+tablinks) 214 215 $( ".cc62_navigation_menu .tab-content .tab-pane .tab-menu .block-cart" ).each(function( index ) { 216 $( this ).removeClass('activeSecond'); 217 }); 218 219 // Show the current tab, and add an "active" class to the button that opened the tab 220 //$("#sec-"+cityName).css("display","block"); 221 $("#sec-"+cityName).slideDown('5000','swing'); 222 $("#sec-"+cityName).addClass('openThird'); 223 $(clicked).find(".elem-"+cityName).addClass('activeSecond'); 224 225 $(clicked).show(500); 226 //$(clicked).slideDown(600); 227 //document.getElementById(cityName).style.display = "block"; 228 setTimeout(() => { 229 var link = $('.third-nav__secciones'); 230 $(link).mouseleave(function (e) { 231 var target = e.relatedTarget; 232 var targeto = e.target; 233 var el_pos = $(this).offset(); 234 var $container = $(".cc62_navigation_menu .tab-content"); 235 var targ = e.offsetY; 236 var prueba = $(this); 237 if(!$(target).hasClass('activeSecond') && targ >= 12){ 238 mouseleaveTabs($container,e); 239 } 240 }); 241 }, 500); 242 $('.cc62_navigation_menu .tab-content .tab-pane .tab-menu.open').mouseleave(function(e) { 243 var el_pos = $(this).offset(); 244 var edge = closestEdge(e.pageX - el_pos.left, (e.pageY + 50) - el_pos.top, $(this)[0].clientWidth, $(this)[0].clientHeight); 245 var $container = $(".cc62_navigation_menu .tab-content"); 246 var targ = e.offsetY 247 if(edge != 'bottom' && targ < 70) { 248 mouseleaveTabs($container,e); 249 } 250 }); 251}
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.