1(function( $ ) { 2 3 var menuAbriendose = false; 4 const offsetSmoothScroll = 150; // adjust as needed 5 6 function actions() { 7 // LENIS 8 const lenis = new Lenis() 9 10 lenis.on('scroll', (e) => { 11 // console.log(e) 12 }) 13 14 function raf(time) { 15 lenis.raf(time) 16 requestAnimationFrame(raf) 17 } 18 19 requestAnimationFrame(raf); 20 21 // ================================ 22 // SEARCHWP + LENIS 23 // - Pausar Lenis cuando se abre el modal 24 // - Permitir scroll nativo dentro del panel de resultados del Live Search 25 // ================================ 26 (function initLenisSearchwpModalLock() { 27 // Añade data-lenis-prevent a los contenedores de resultados de SearchWP (se crean dinámicamente) 28 function applyLenisPreventToSearchwp() { 29 const selectors = [ 30 '.searchwp-live-search-results', 31 '#searchwp-live-search-results', 32 '.searchwp-live-search-results-wrapper', 33 '.searchwp-live-search-result' // por si tu theme/plugin usa este contenedor 34 ]; 35 36 selectors.forEach((sel) => { 37 document.querySelectorAll(sel).forEach((el) => { 38 if (!el.hasAttribute('data-lenis-prevent')) { 39 el.setAttribute('data-lenis-prevent', ''); 40 } 41 }); 42 }); 43 } 44 45 function syncLenisWithModal() { 46 const isOpen = $('.searchwp-modal-form.is-open').length > 0; 47 48 if (isOpen) { 49 if (typeof lenis.stop === 'function') lenis.stop(); 50 $('html').addClass('searchwp-modal-open'); 51 52 // cuando se abre, aplica el prevent al panel y wrappers 53 applyLenisPreventToSearchwp(); 54 } else { 55 if (typeof lenis.start === 'function') lenis.start(); 56 $('html').removeClass('searchwp-modal-open'); 57 } 58 } 59 60 // 1) Estado inicial 61 syncLenisWithModal(); 62 applyLenisPreventToSearchwp(); 63 64 // 2) Observa cambios (modal y panel se insertan/actualizan) 65 const obs = new MutationObserver(function () { 66 syncLenisWithModal(); 67 applyLenisPreventToSearchwp(); 68 }); 69 70 obs.observe(document.documentElement, { 71 subtree: true, 72 childList: true, 73 attributes: true, 74 attributeFilter: ['class'], 75 }); 76 77 // 3) Al cerrar con tu botón custom (extra de seguridad) 78 $(document).on('click', '.searchwp-modal-close--custom', function () { 79 if (typeof lenis.start === 'function') lenis.start(); 80 $('html').removeClass('searchwp-modal-open'); 81 }); 82 83 // 4) Al cerrar con ESC (extra) 84 $(document).on('keydown', function (e) { 85 if (e.key === 'Escape') { 86 if (typeof lenis.start === 'function') lenis.start(); 87 $('html').removeClass('searchwp-modal-open'); 88 } 89 }); 90 91 })(); 92 93 // AOS 94 AOS.init(); 95 96 // SCROLL TRIGGER 97 gsap.registerPlugin(ScrollTrigger) 98 99 // FANCYBOX 100 Fancybox.bind('[data-fancybox]', { 101 Toolbar: { 102 display: { 103 left: [], 104 middle: [], 105 right: ['close'], 106 }, 107 }, 108 Thumbs: false, 109 }); 110 111 // MENU BURGER 112 $(".openMenuMobile").click(function () { 113 if(menuAbriendose == false) { 114 abreMenu(); 115 } 116 }); 117 118 $(".closeMenuMobile").click(function () { 119 if(menuAbriendose == false) { 120 cierraMenu(); 121 } 122 }); 123 124 // MOVER CLASE HOVER AL A 125 $('header#masthead .bar-ppal .menu-general > div > ul > li.hover-subrayo').each(function () { 126 const $li = $(this); 127 const $a = $li.children('a'); 128 if ($a.length) { 129 $a.addClass('hover-subrayo'); 130 $li.removeClass('hover-subrayo'); 131 } 132 }); 133 134 // HOVER DESPLIEGA MENà 135 $('header#masthead .bar-ppal .menu-general > div > ul > li').hover( 136 function() { 137 $(this).find('ul.sub-menu').addClass('on'); 138 }, function() { 139 $(this).find('ul.sub-menu').removeClass('on'); 140 } 141 ); 142 143 // SCROLL MENU 144 const body = document.querySelector("html body"); // Select the body element 145 var btnTop = $('.btn-top'); 146 const navHeight = 125; 147 let lastScrollY = 0; 148 const delta = 100; 149 let menuOpenRemoved = false; 150 const topThreshold = 100; 151 152 // BTN TOP oculto en top 153 gsap.set(btnTop, { autoAlpha: 0, y: 0 }); 154 155 // BTN TOP te lleva a top 156 btnTop.on('click', function(e) { 157 e.preventDefault(); 158 if (window.lenis && typeof window.lenis.scrollTo === 'function') { 159 window.lenis.scrollTo(0, { duration: .5 }); 160 } else { 161 $('html, body').animate({ scrollTop: 0 }, 500); 162 } 163 }); 164 165 // Mostrar/ocultar .btn-top según scroll 166 function toggleBtnTop(sy) { 167 if (sy > topThreshold) { 168 gsap.to(btnTop, { autoAlpha: 1, duration: 0.25, ease: 'power2.out' }); 169 } else { 170 gsap.to(btnTop, { autoAlpha: 0, duration: 0.2, ease: 'power2.out' }); 171 } 172 } 173 174 function scrolled() { 175 let sy = window.scrollY; 176 toggleBtnTop(sy); 177 178 // Check if the body element has the menuDesktopOpen class 179 const isMenuOpen = body.classList.contains("menuDesktopOpen"); 180 181 if (isMenuOpen && !menuOpenRemoved && !menuAbriendose) { 182 // If the menu is open and removal not completed, remove the class and toggle the navigation 183 cierraMenu(); 184 185 // Reset the flag after a delay (e.g., 1 second) 186 setTimeout(function () { 187 menuOpenRemoved = false;
188 }, 400); 189 190 menuOpenRemoved = true; 191 return; 192 } 193 194 if (Math.abs(lastScrollY - sy) > delta) { 195 if (sy > lastScrollY && sy > navHeight) { 196 // If scrolling down and below navHeight, hide nav bar with transition 197 if(!menuAbriendose) { 198 gsap.to('header#masthead .main-header', { 199 y: '-100%', 200 duration: 0.5, 201 ease: 'power2.out', 202 }); 203 204 gsap.to(btnTop, { 205 y: '5em', 206 duration: 0.5, 207 ease: 'power2.out' 208 }); 209 210 $('header#masthead .bar-ppal ul.sub-menu').removeClass('on'); 211 } 212 } else if (sy < lastScrollY || sy < navHeight) { 213 // If scrolling up or at the top, show nav bar with transition 214 if(!menuAbriendose) { 215 gsap.to('header#masthead .main-header', { 216 y: 0, 217 duration: 0.5, 218 ease: 'power2.out', 219 }); 220 221 gsap.to(btnTop, { 222 y: 0, 223 duration: 0.5, 224 ease: 'power2.out' 225 }); 226 } 227 } 228 lastScrollY = sy; 229 } 230 } 231 232 let didScroll = false; 233 window.addEventListener("scroll", function (e) { 234 didScroll = true; 235 }); 236 237 toggleBtnTop(window.scrollY); 238 239 setInterval(function () { 240 if (didScroll) { 241 scrolled(); 242 didScroll = false; 243 } 244 }, 100); 245 246 // ANCHORS MENà MOBILE SMOOTH SCROLL 247 $('#mobile-navigation .bottom a, header#masthead .menu-menu-general-submenus-container a').each(function() { 248 const href = $(this).attr('href'); 249 const url = new URL(href, window.location.href); 250 const anchor = url.hash; 251 252 // If it's an internal anchor link on the same page 253 if (url.pathname === window.location.pathname && anchor && anchor.length > 1 && $(anchor).length) { 254 // Add a custom class to its parent <li> 255 $(this).closest('li').addClass('anchor-link'); 256 } 257 }); 258 259 $('#mobile-navigation .bottom a, header#masthead .menu-menu-general-submenus-container a').on('click', function(e) { 260 const href = $(this).attr('href'); 261 const url = new URL(href, window.location.href); 262 const anchor = url.hash; 263 264 if (url.pathname === window.location.pathname && anchor && anchor.length > 1 && $(anchor).length) { 265 e.preventDefault(); 266 267 const targetElement = $(anchor)[0]; 268 const targetPosition = targetElement.getBoundingClientRect().top + window.scrollY - offsetSmoothScroll; 269 270 lenis.scrollTo(targetPosition); 271 } 272 }); 273 274 /* HOVER IMÃGENES MENà */ 275 $('#mobile-navigation .col-hover').each(function() { 276 const $col = $(this); 277 const $images = $col.find('.imagenes-hover img'); 278 const $default = $images.filter('.on'); // The original "on" image 279 280 $col.find('nav li').on('mouseenter', function() { 281 const classList = $(this).attr('class').split(/\s+/); 282 // Look for a class that matches an image 283 for (let i = 0; i < classList.length; i++) { 284 const match = classList[i]; 285 if ($images.hasClass(match)) { 286 $images.removeClass('on'); 287 $images.filter('.' + match).addClass('on'); 288 break; 289 } 290 } 291 }); 292 293 $col.find('nav li').on('mouseleave', function() { 294 // Restore original 295 $images.removeClass('on'); 296 $default.addClass('on'); 297 }); 298 }); 299 300 // POLYLANG FOOTER 301 $('.idioma select').on('change', function() { 302 var url = $(this).val(); 303 if (url) { 304 window.location.href = url; 305 } 306 }); 307 308 // =================================== 309 // SEARCH WP: Mantener idioma al enviar SearchWP Form 310 // =================================== 311 (function () { 312 function desiredAction() { 313 const urls = window.MYSITE_SEARCHWP || {}; 314 const langAttr = ($('html').attr('lang') || '').toLowerCase(); 315 316 if (langAttr.startsWith('es')) return urls.es; 317 if (langAttr.startsWith('en')) return urls.en; 318 if (langAttr.startsWith('ca')) return urls.ca; 319 320 return urls.es; 321 } 322 323 function fixSearchwpForms() { 324 const action = desiredAction(); 325 const $forms = $('form.searchwp-form, form.searchwp-live-search-form'); 326 327 $forms.each(function () { 328 this.action = action; 329 }); 330 } 331 332 // 1) al cargar 333 fixSearchwpForms(); 334 335 // 2) antes de enviar (por si algo lo cambia) 336 $(document).on('submit', 'form.searchwp-form, form.searchwp-live-search-form', function () { 337 this.action = desiredAction(); 338 }); 339 340 // 3) por si el modal inserta el form dinámicamente 341 const obs = new MutationObserver(function () { 342 fixSearchwpForms(); 343 }); 344 obs.observe(document.body, { childList: true, subtree: true }); 345 })(); 346 347 // =========================================== 348 // SEARCHWP MODAL: cerrar con .btn-cerrar o click fuera del wrap 349 // =========================================== 350 function closeSearchwpModal() { 351 // 1) Si el plugin tiene un botón de cerrar propio, lo disparamos (más seguro)
352 var $nativeClose = $('.searchwp-modal-close, .searchwp-modal__close, [data-searchwp-modal-close]').first(); 353 if ($nativeClose.length) { 354 $nativeClose.trigger('click'); 355 return; 356 } 357 358 // 2) Fallback: tu modal se controla con la clase is-open 359 $('.searchwp-modal-form').removeClass('is-open'); 360 } 361 362 // Cerrar al clicar tu botón 363 $(document).on('click', '.searchwp-modal-form-wrap .btn-cerrar', function (e) { 364 e.preventDefault(); 365 e.stopPropagation(); 366 closeSearchwpModal(); 367 }); 368 369 // Cerrar al clicar fuera del wrap (solo si está abierto) 370 $(document).on('mousedown touchstart', function (e) { 371 if (!$('.searchwp-modal-form.is-open').length) return; 372 if ($(e.target).closest('.searchwp-modal-form-wrap').length) return; 373 if ($(e.target).closest('[href^="#searchwp-modal-"], .searchwp-modal-trigger').length) return; 374 375 closeSearchwpModal(); 376 }); 377 378 if($("body").is(".page-template-template-home, .page-template-template-apoyo")) { 379 // SLIDER NOTICIAS SOCIOS 380 const swiperNoticias = new Swiper('.sec-novedades-socios .galeria-destacadas .swiper', { 381 direction: 'horizontal', 382 loop: true, 383 fadeEffect: { 384 crossFade: true 385 }, 386 effect: "fade", 387 autoplay: { 388 delay: 6000, 389 }, 390 speed: 1000, 391 pagination: { 392 el: '.sec-novedades-socios .galeria-destacadas .swiper-pagination', 393 clickable: true, 394 } 395 }); 396 397 igualarAlturaNoticiasSocios(); 398 } 399 400 if($("body").is(".page-template-template-home, .page-template-template-accion-social")) { 401 // PARALLAX PEGATINAS 402 gsap.to(".parallax", { 403 scrollTrigger: { 404 scrub: 1 405 }, 406 y: (i, target) => -ScrollTrigger.maxScroll(window) * target.dataset.speed, 407 ease: "none" 408 }); 409 } 410 411 if($("body").hasClass("page-template-template-fundacion")){ 412 /* SLIDER INTRO */ 413 const swiperIntro = new Swiper('.sec-intro .swiper', { 414 direction: 'horizontal', 415 loop: true, 416 fadeEffect: { 417 crossFade: true 418 }, 419 effect: "fade", 420 autoplay: { 421 delay: 6000, 422 }, 423 speed: 1000, 424 navigation: { 425 nextEl: '.sec-intro .swiper-button-next', 426 prevEl: '.sec-intro .swiper-button-prev', 427 } 428 }); 429 430 /* SLIDER MISIÃN */ 431 const swiperMision = new Swiper('.sec-mision .swiper', { 432 direction: 'horizontal', 433 loop: true, 434 fadeEffect: { 435 crossFade: true 436 }, 437 effect: "fade", 438 autoplay: { 439 delay: 6000, 440 }, 441 autoHeight: true, 442 speed: 1000, 443 navigation: { 444 nextEl: '.sec-mision .swiper-button-next', 445 prevEl: '.sec-mision .swiper-button-prev', 446 } 447 }); 448 449 /* SLIDER SEDE */ 450 const swiperSede = new Swiper('.sec-sede .swiper', { 451 direction: 'horizontal', 452 loop: true, 453 fadeEffect: { 454 crossFade: true 455 }, 456 effect: "fade", 457 autoplay: { 458 delay: 6000, 459 }, 460 speed: 1000, 461 pagination: { 462 el: '.sec-sede .swiper-pagination', 463 clickable: true, 464 }, 465 navigation: { 466 nextEl: '.sec-sede .swiper-button-next', 467 prevEl: '.sec-sede .swiper-button-prev', 468 } 469 }); 470 471 /* SLIDER COLABORADORES */ 472 var splideColaboradores = new Splide('.sec-colaboradores .splide', { 473 type: 'loop', 474 drag: 'free', 475 focus: 'center', 476 autoWidth: true, 477 gap: '5em', 478 arrows: false, 479 pagination: false, 480 autoScroll: { 481 speed: -0.5, 482 pauseOnHover: false, 483 pauseOnFocus: false, 484 }, 485 breakpoints: { 486 1000: { 487 gap: '3em', 488 }, 489 600: { 490 gap: '2em', 491 } 492 } 493 }); 494 495 splideColaboradores.mount(window.splide.Extensions); 496 497 // SLIDER LIBROS 498 const swiperRelacionados = new Swiper('.sec-libros .swiper', { 499 direction: 'horizontal', 500 loop: true, 501 slidesPerView: 2, 502 spaceBetween: 18, 503 autoplay: { 504 delay: 6000, 505 }, 506 navigation: { 507 nextEl: '.sec-libros .swiper-button-next', 508 prevEl: '.sec-libros .swiper-button-prev', 509 }, 510 breakpoints: { 511 1010: { 512 slidesPerView: 3, 513 spaceBetween: 48, 514 }, 515 680: { 516 slidesPerView: 2, 517 spaceBetween: 32, 518 } 519 } 520 }); 521 } 522 523 if($("body").is(".page-template-template-fundacion, .page-template-template-equipo, .page-template-template-accion-social, .page-template-template-apoyo, .page-template-template-comunidad")){ 524 /* DESPLEGABLES BIOS */ 525 $('.caja-equipo').click(function(){ 526 $(this).find('.cabecera-bio').toggleClass('on'); 527 $(this).find('.contenido-bio').slideToggle(); 528 refreshAOS(); 529 }); 530 } 531 532 if($("body").hasClass("page-template-template-equipo")){ 533 /* DESPLEGABLES SIN FOTO */ 534 $('.listado-equipo:not(.eqeuipo) .caja-equipo .cabecera').click(function(){ 535 $(this).toggleClass('on'); 536 $(this).parent().find('.contenido').slideToggle(); 537 refreshAOS(); 538 }); 539 } 540 541 if ($('body').hasClass('single-libro')) { 542 // SLIDER GALERÃA 543 if ($('.sec-galeria .splide').length) {
544 var splideGaleria = new Splide('.sec-galeria .splide', { 545 type: 'loop', 546 focus: 'center', 547 autoWidth: true, 548 gap: '.5em', 549 arrows: true, 550 arrowPath: 'M0.382812 0.906799L20.3828 20.9068L0.382812 40.9068', 551 pagination: false, 552 }); 553 554 var $contador = $('.sec-galeria .contador'); 555 556 function actualizarContador() { 557 var total = splideGaleria.length; 558 var actual = (splideGaleria.index % total) + 1; 559 $contador.text(actual + ' | ' + total); 560 } 561 562 splideGaleria.on('mounted', actualizarContador); 563 splideGaleria.on('move', actualizarContador); 564 splideGaleria.on('updated', actualizarContador); 565 566 splideGaleria.mount(); 567 } 568 569 // SLIDER RELACIONADOS 570 const swiperRelacionados = new Swiper('.sec-relacionados .swiper', { 571 direction: 'horizontal', 572 loop: true, 573 slidesPerView: 2, 574 spaceBetween: 18, 575 navigation: { 576 nextEl: '.sec-relacionados .swiper-button-next', 577 prevEl: '.sec-relacionados .swiper-button-prev', 578 }, 579 breakpoints: { 580 1010: { 581 slidesPerView: 3, 582 spaceBetween: 48, 583 }, 584 680: { 585 slidesPerView: 2, 586 spaceBetween: 32, 587 } 588 } 589 }); 590 } 591 592 if($("body").hasClass("page-template-template-archivos")){ 593 /* SLIDER */ 594 const swiperArchivos = new Swiper('.sec-slider .swiper', { 595 direction: 'horizontal', 596 loop: true, 597 fadeEffect: { 598 crossFade: true 599 }, 600 effect: "fade", 601 autoplay: { 602 delay: 6000, 603 }, 604 speed: 1000, 605 navigation: { 606 nextEl: '.sec-slider .swiper-button-next', 607 prevEl: '.sec-slider .swiper-button-prev', 608 } 609 }); 610 } 611 612 if ($("body").hasClass("page-template-template-talleres")) { 613 const grid = $('.sec-historico .listado-talleres'); 614 const iso = new Isotope(grid[0], { 615 itemSelector: '.caja-taller', 616 layoutMode: 'masonry', 617 transitionDuration: 0, 618 }); 619 620 const botones = $('.filtros .btn-filtro'); 621 622 function activateFilter(slug) { 623 const $activeBtn = $(`.btn-filtro[data-filter="${slug}"]`); 624 625 if ($activeBtn.hasClass('on')) { 626 iso.arrange({ filter: '*' }); 627 botones.removeClass('on'); 628 history.replaceState(null, null, window.location.pathname); 629 } else { 630 iso.arrange({ filter: '.' + slug }); 631 botones.removeClass('on'); 632 $activeBtn.addClass('on'); 633 history.replaceState(null, null, '#' + slug); 634 } 635 636 refreshAOS(); 637 } 638 639 botones.on('click', function () { 640 const filtro = $(this).data('filter'); 641 activateFilter(filtro); 642 }); 643 644 $('.sec-historico .listado-talleres').on('click', '.btn-categoria', function (e) { 645 e.preventDefault(); 646 const slug = $(this).data('term'); 647 activateFilter(slug); 648 }); 649 650 const hash = window.location.hash.replace('#', ''); 651 if (hash) { 652 activateFilter(hash); 653 } 654 655 iso.on('arrangeComplete', function () { 656 refreshAOS(); 657 }); 658 } 659 660 if($("body").hasClass("single-taller")){ 661 /* SLIDER */ 662 const swiperArchivos = new Swiper('.sec-galeria .swiper', { 663 direction: 'horizontal', 664 loop: true, 665 fadeEffect: { 666 crossFade: true 667 }, 668 effect: "fade", 669 autoplay: { 670 delay: 6000, 671 }, 672 speed: 1000, 673 navigation: { 674 nextEl: '.sec-galeria .swiper-button-next', 675 prevEl: '.sec-galeria .swiper-button-prev', 676 } 677 }); 678 } 679 680 if ($("body").hasClass("page-template-template-exposiciones")) { 681 const grid = $('.sec-historico .listado-exposiciones'); 682 const sinResultados = $('.sec-historico .sin-resultados'); 683 const iso = new Isotope(grid[0], { 684 itemSelector: '.caja-exposicion', 685 layoutMode: 'masonry', 686 transitionDuration: 0, 687 }); 688 689 function toggleSinResultados() { 690 const hayResultados = iso.filteredItems.length > 0; 691 sinResultados.toggle(!hayResultados); 692 } 693 694 iso.on('arrangeComplete', function () { 695 toggleSinResultados(); 696 refreshAOS(); 697 }); 698 699 // Filtro activo por grupo: { proyecto: 'slug'|null, tematica: 'slug'|null } 700 const activeFilters = { proyecto: null, tematica: null }; 701 702 function buildFilterFn() { 703 // Sin filtros activos -> mostrar todo 704 if (!activeFilters.proyecto && !activeFilters.tematica) return '*'; 705 706 // Combina ambos grupos con AND: la caja debe cumplir los que estén activos 707 return function () { 708 const $item = $(this); 709 const matchProyecto = !activeFilters.proyecto || $item.hasClass(activeFilters.proyecto); 710 const matchTematica = !activeFilters.tematica || $item.hasClass(activeFilters.tematica); 711 return matchProyecto && matchTematica; 712 }; 713 } 714 715 function updateButtonsState() { 716 $('.filtros .btn-filtro').removeClass('on'); 717 if (activeFilters.proyecto) { 718 $(`.filtros .filtro.proyecto .btn-filtro[data-filter="${activeFilters.proyecto}"]`).addClass('on'); 719 } 720 if (activeFilters.tematica) { 721 $(`.filtros .filtro.tematica .btn-filtro[data-filter="${activeFilters.tematica}"]`).addClass('on'); 722 } 723 } 724 725 function updateHash() { 726 const parts = []; 727 if (activeFilters.proyecto) parts.push('proyecto=' + activeFilters.proyecto); 728 if (activeFilters.tematica) parts.push('tematica=' + activeFilters.tematica); 729 730 if (parts.length) { 731 history.replaceState(null, null, '#' + parts.join('&')); 732 } else { 733 history.replaceState(null, null, window.location.pathname); 734 } 735 } 736 737 function activateFilter(slug, group) { 738 // group debe ser 'proyecto' o 'tematica' 739 if (!group || !(group in activeFilters)) return; 740 741 // Toggle: si ya estaba activo ese slug en ese grupo, se desactiva 742 activeFilters[group] = (activeFilters[group] === slug) ? null : slug; 743 744 iso.arrange({ filter: buildFilterFn() }); 745 updateButtonsState(); 746 updateHash(); 747 refreshAOS(); 748 } 749 750 // Clic en los botones del bloque .filtros (ya sabemos su grupo por el data-group del contenedor .filtro) 751 $('.filtros .btn-filtro').on('click', function () { 752 const slug = $(this).data('filter'); 753 const group = $(this).closest('.filtro').data('group'); 754 activateFilter(slug, group); 755 }); 756 757 // Clic en los .btn-categoria dentro de cada caja-exposicion 758 $('.sec-historico .listado-exposiciones').on('click', '.btn-categoria', function (e) { 759 e.preventDefault(); 760 const slug = $(this).data('term'); 761 const group = $(this).hasClass('tematica') ? 'tematica' : 'proyecto'; 762 activateFilter(slug, group); 763 }); 764 765 // Restaurar filtros desde el hash de la URL, ej: #proyecto=slug1&tematica=slug2 766 const hash = window.location.hash.replace('#', ''); 767 if (hash) { 768 const params = new URLSearchParams(hash); 769 const proyectoSlug = params.get('proyecto'); 770 const tematicaSlug = params.get('tematica'); 771 772 if (proyectoSlug) activeFilters.proyecto = proyectoSlug; 773 if (tematicaSlug) activeFilters.tematica = tematicaSlug; 774 775 if (proyectoSlug || tematicaSlug) { 776 iso.arrange({ filter: buildFilterFn() }); 777 updateButtonsState(); 778 } else { 779 // Compatibilidad con el formato de hash antiguo (#slug suelto) 780 // Se intenta primero como filtro de proyecto 781 activateFilter(hash, 'proyecto'); 782 } 783 } 784 } 785 786 if($("body").hasClass("single-exposicion")){ 787 /* SLIDER */ 788 const swiperArchivos = new Swiper('.sec-galeria .swiper', { 789 direction: 'horizontal', 790 loop: true, 791 fadeEffect: { 792 crossFade: true 793 }, 794 effect: "fade", 795 autoplay: { 796 delay: 6000, 797 }, 798 speed: 1000, 799 navigation: { 800 nextEl: '.sec-galeria .swiper-button-next', 801 prevEl: '.sec-galeria .swiper-button-prev', 802 } 803 }); 804 } 805 806 if($("body").hasClass("page-template-template-apoyo")) { 807 // IMG MENà 808 $('.sec-intro .listado li').hover( 809 function() { 810 const className = $(this).attr('class').split(' ')[0]; 811 812 $('.imagenes figure').removeClass('on'); 813 $('.imagenes figure.' + className).addClass('on'); 814 }, 815 function() { 816 $('.imagenes figure').removeClass('on'); 817 $('.imagenes figure.general').addClass('on'); 818 } 819 ); 820 821 /* SLIDER MÃVIL */ 822 const swiperArchivos = new Swiper('.sec-intro .swiper', { 823 direction: 'horizontal', 824 loop: true, 825 fadeEffect: { 826 crossFade: true 827 }, 828 effect: "fade", 829 autoplay: { 830 delay: 6000, 831 }, 832 speed: 1000, 833 navigation: { 834 nextEl: '.sec-intro .swiper-button-next', 835 prevEl: '.sec-intro .swiper-button-prev', 836 } 837 }); 838 } 839 840 if($("body").hasClass("page-template-template-reconocimiento")) { 841 // MENà ACTIVO SCROLL 842 var $win = $(window); 843 var $links = $('.menu-sticky a'); 844 // collect section elements 845 var sections = $links.map(function(){ 846 var sec = document.getElementById(this.hash.slice(1)); 847 return sec ? sec : null; 848 }).get(); 849 850 // EDICIONES ANTERIORES: sección contenedora + edición apuntada por el hash al cargar (si la hay) 851 var $secEdicionesAnteriores = $('.sec-ediciones-anteriores'); 852 var idSecEdicionesAnteriores = $secEdicionesAnteriores.attr('id'); 853 var hashInicial = window.location.hash.replace('#', ''); 854 var elCajaInicial = hashInicial ? document.getElementById(hashInicial) : null; 855 var esEdicionInicialValida = !!(elCajaInicial 856 && elCajaInicial.classList.contains('caja-edicion') 857 && $(elCajaInicial).closest('.sec-ediciones-anteriores').length); 858 859 // id de la edición actualmente abierta en "otras ediciones" (o null si ninguna lo está) 860 var edicionAbiertaId = esEdicionInicialValida ? hashInicial : null; 861 862 // throttle helper 863 function throttle(fn, wait) { 864 var last = 0; 865 return function() { 866 var now = Date.now(); 867 if (now - last < wait) return; 868 last = now; 869 fn.apply(this, arguments); 870 }; 871 } 872 873 // core scroll-spy logic 874 function onScroll(pos){ 875 var scrollTop = (typeof pos === 'number') 876 ? pos 877 : $win.scrollTop(); 878 var winMid = scrollTop + ($win.height()/2); 879 var currentSec = null; 880 881 sections.forEach(function(sec){ 882 if (sec.offsetTop <= winMid) currentSec = sec; 883 }); 884 if (!currentSec) return; 885 886 // El link activo del menú siempre refleja la sección genérica... 887 var idActivo = currentSec.id; 888 889 // ...pero si estamos dentro de "otras ediciones" y hay una edición abierta, 890 // el hash de la URL refleja esa edición en concreto. 891 var idHash = (currentSec.id === idSecEdicionesAnteriores && edicionAbiertaId) 892 ? edicionAbiertaId 893 : currentSec.id; 894 895 $links.parent().removeClass('on') 896 .end() 897 .filter('[href="#'+idActivo+'"]') 898 .parent().addClass('on'); 899
900 history.replaceState(null, null, '#'+idHash); 901 } 902 903 var handler = throttle(onScroll, 100); 904 905 // Lenis scroll event or fallback 906 if (window.lenis && typeof window.lenis.on === 'function') { 907 // initial highlight 908 onScroll(window.lenis.scroll || $win.scrollTop()); 909 window.lenis.on('scroll', function(e){ 910 handler(e.scroll); 911 }); 912 } else { 913 $win.on('scroll', handler).trigger('scroll'); 914 } 915 916 // smooth-scroll on click with offset 917 $('.menu-sticky').on('click', 'a[href^="#"]', function(e){ 918 var hash = this.hash; 919 var target = document.getElementById(hash.slice(1)); 920 if (!target) return; // ignore external or missing 921 922 e.preventDefault(); 923 924 if (window.lenis && typeof window.lenis.scrollTo === 'function') { 925 lenis.scrollTo(target, { offset: offsetSmoothScroll }); 926 } else { 927 $('html, body').animate({ 928 scrollTop: $(target).offset().top - offsetSmoothScroll 929 }, 600); 930 } 931 932 history.pushState(null, null, hash); 933 }); 934 935 // SLIDERS 936 $(".contenido .galeria").each(function() { 937 var currentSliderDiv = $(this); 938 var currentSlider = currentSliderDiv.find(".swiper"); 939 var pagination = currentSliderDiv.find(".swiper-pagination"); 940 var prevEl = currentSliderDiv.find(".swiper-button-prev"); 941 var nextEl = currentSliderDiv.find(".swiper-button-next"); 942 var slider = new Swiper(currentSlider[0], { 943 direction: 'horizontal', 944 loop: true, 945 fadeEffect: { 946 crossFade: true 947 }, 948 effect: "fade", 949 autoplay: { 950 delay: 6000, 951 }, 952 speed: 1000, 953 pagination: { 954 el: pagination[0], 955 clickable: true, 956 }, 957 navigation: { 958 nextEl: prevEl[0], 959 prevEl: nextEl[0], 960 } 961 }); 962 }); 963 964 // DESPLEGABLE JURADO 965 $('.sec-convocatoria .jurado .cabecera-jurado').click(function() { 966 $(this).find('svg').toggleClass('on'); 967 $(this).siblings('.contenido-desplegable').slideToggle(); 968 refreshAOS(); 969 }); 970 971 // DESPLEGABLES EDICIONES ANTERIORES (anclaje continuo durante animaciones) 972 const DUR_SLIDE = 240; // ms 973 let isAnimating = false; 974 975 function compensateScrollToKeepViewportTop(el, topBefore) { 976 const topAfter = el.getBoundingClientRect().top; 977 const delta = topAfter - topBefore; 978 979 if (Math.abs(delta) < 0.5) return; 980 981 const current = (window.lenis ? window.lenis.scroll : window.pageYOffset); 982 const target = current + delta; 983 984 if (window.lenis && typeof window.lenis.scrollTo === 'function') { 985 window.lenis.scrollTo(target, { immediate: true }); 986 } else { 987 window.scrollTo(0, target); 988 } 989 } 990 991 // Abre/cierra la edición cuya cabecera se pasa. Sólo puede haber una abierta a la vez. 992 // Actualiza edicionAbiertaId y el hash de la URL en consecuencia. 993 function toggleEdicionAnterior($cabecera) { 994 if (isAnimating || !$cabecera || !$cabecera.length) return; 995 isAnimating = true; 996 997 const cabeceraEl = $cabecera[0]; 998 999 const $caja = $cabecera.closest('.caja-edicion'); 1000 const $panel = $caja.find('.contenido-desplegable'); 1001 const idEdicion = $caja.attr('id'); 1002 1003 const $allPanels = $('.sec-ediciones-anteriores .contenido-desplegable'); 1004 const $allHeaders = $('.sec-ediciones-anteriores .caja-edicion .cabecera'); 1005 const $allSvgs = $('.sec-ediciones-anteriores .caja-edicion .cabecera svg'); 1006 1007 $allPanels.stop(true, true); 1008 1009 // 1) guardamos posición visual del header antes de tocar el layout 1010 const topBefore = cabeceraEl.getBoundingClientRect().top; 1011 1012 // 2) activamos anclaje continuo mientras dure la animación 1013 let keepAnchored = true; 1014 function anchorLoop() { 1015 if (!keepAnchored) return; 1016 compensateScrollToKeepViewportTop(cabeceraEl, topBefore); 1017 requestAnimationFrame(anchorLoop); 1018 } 1019 requestAnimationFrame(anchorLoop); 1020 1021 function setOpenState($h, open) { 1022 $h.attr('aria-expanded', open ? 'true' : 'false'); 1023 $h.find('svg').toggleClass('on', open); 1024 } 1025 1026 function finish() { 1027 // deja que el DOM termine de asentarse 1028 if (typeof refreshAOS === 'function') refreshAOS(); 1029 1030 requestAnimationFrame(() => { 1031 // 3) paramos el anclaje continuo y hacemos el ajuste final por si AOS/imagenes variaron altura
1032 keepAnchored = false; 1033 compensateScrollToKeepViewportTop(cabeceraEl, topBefore); 1034 isAnimating = false; 1035 }); 1036 } 1037 1038 const isOpen = $panel.is(':visible'); 1039 1040 // Caso: cerrar el mismo 1041 if (isOpen) { 1042 setOpenState($cabecera, false); 1043 $panel.slideUp(DUR_SLIDE, finish); 1044 1045 edicionAbiertaId = null; 1046 if (idSecEdicionesAnteriores) { 1047 history.replaceState(null, null, '#' + idSecEdicionesAnteriores); 1048 } 1049 return; 1050 } 1051 1052 // Caso: abrir este y cerrar los demás 1053 const $othersOpen = $allPanels.not($panel).filter(':visible'); 1054 1055 // Estado visual inmediato 1056 $allSvgs.not($cabecera.find('svg')).removeClass('on'); 1057 $allHeaders.not($cabecera).attr('aria-expanded', 'false'); 1058 1059 let pending = $othersOpen.length; 1060 1061 const openCurrent = () => { 1062 setOpenState($cabecera, true); 1063 $panel.slideDown(DUR_SLIDE, finish); 1064 1065 edicionAbiertaId = idEdicion || null; 1066 if (idEdicion) { 1067 history.replaceState(null, null, '#' + idEdicion); 1068 } 1069 }; 1070 1071 if (!pending) { 1072 openCurrent(); 1073 } else { 1074 $othersOpen.each(function () { 1075 $(this).slideUp(DUR_SLIDE, () => { 1076 pending--; 1077 if (pending === 0) openCurrent(); 1078 }); 1079 }); 1080 } 1081 } 1082 1083 $('.sec-ediciones-anteriores .caja-edicion .cabecera').on('click', function () { 1084 toggleEdicionAnterior($(this)); 1085 }); 1086 1087 // ABRIR EDICIÃN ANTERIOR DESDE EL HASH AL CARGAR LA PÃGINA 1088 if (esEdicionInicialValida) { 1089 setTimeout(function () { 1090 const $cabeceraInicial = $(elCajaInicial).find('> .cabecera'); 1091 toggleEdicionAnterior($cabeceraInicial); 1092 1093 // Por si Lenis no respetó el anclaje nativo del navegador al #hash 1094 setTimeout(function () { 1095 if (window.lenis && typeof window.lenis.scrollTo === 'function') { 1096 lenis.scrollTo(elCajaInicial, { offset: offsetSmoothScroll }); 1097 } else { 1098 $('html, body').animate({ 1099 scrollTop: $(elCajaInicial).offset().top - offsetSmoothScroll 1100 }, 600); 1101 } 1102 }, 350); 1103 }, 300); 1104 } 1105 } 1106 1107 if ($("body").is(".single-asesoria, .single-formacion")) { 1108 // SLIDER GALERÃA 1109 const swiperGaleria = new Swiper('.sec-galeria .swiper', { 1110 direction: 'horizontal', 1111 loop: true, 1112 fadeEffect: { 1113 crossFade: true 1114 }, 1115 effect: "fade", 1116 autoplay: { 1117 delay: 6000, 1118 }, 1119 speed: 1000, 1120 pagination: { 1121 el: '.sec-galeria .swiper-pagination', 1122 clickable: true, 1123 }, 1124 navigation: { 1125 nextEl: '.sec-galeria .swiper-button-next', 1126 prevEl: '.sec-slgaleriaider .swiper-button-prev', 1127 } 1128 }); 1129 1130 // SLIDER OTROS 1131 const swiperOtros = new Swiper('.sec-otros .swiper', { 1132 direction: 'horizontal', 1133 loop: true, 1134 slidesPerView: 1, 1135 spaceBetween: 0, 1136 autoplay: { 1137 delay: 6000, 1138 }, 1139 navigation: { 1140 nextEl: '.sec-otros .swiper-button-next', 1141 prevEl: '.sec-otros .swiper-button-prev', 1142 }, 1143 breakpoints: { 1144 1000: { 1145 slidesPerView: 3, 1146 spaceBetween: 30, 1147 }, 1148 600: { 1149 slidesPerView: 2, 1150 spaceBetween: 24, 1151 } 1152 }, 1153 on: { 1154 init: function () { 1155 setTimeout(igualarAlturaOtros, 500); 1156 refreshAOS(); 1157 }, 1158 } 1159 }); 1160 } 1161 1162 if ($("body").hasClass("page-template-template-guia")) { 1163 const grid = $('.sec-guia .listado-guia'); 1164 const iso = new Isotope(grid[0], { 1165 itemSelector: '.caja-guia', 1166 layoutMode: 'fitRows', 1167 transitionDuration: 0, 1168 }); 1169 1170 const botones = $('.filtros .btn-filtro'); 1171 1172 function setActiveButton(filterVal) { 1173 botones.removeClass('on'); 1174 $(`.btn-filtro[data-filter="${filterVal}"]`).addClass('on'); 1175 } 1176 1177 function activateFilter(filterVal) { 1178 if (filterVal === '*' || !filterVal) { 1179 iso.arrange({ filter: '*' }); 1180 setActiveButton('*'); 1181 history.replaceState(null, null, window.location.pathname); 1182 refreshAOS(); 1183 return; 1184 } 1185 1186 const $activeBtn = $(`.btn-filtro[data-filter="${filterVal}"]`); 1187 if ($activeBtn.hasClass('on')) { 1188 iso.arrange({ filter: '*' }); 1189 setActiveButton('*'); 1190 history.replaceState(null, null, window.location.pathname); 1191 } else { 1192 iso.arrange({ filter: '.' + filterVal }); 1193 setActiveButton(filterVal); 1194 history.replaceState(null, null, '#' + filterVal); 1195 } 1196 1197 refreshAOS(); 1198 } 1199 1200 botones.on('click', function (e) { 1201 e.preventDefault(); 1202 const filtro = $(this).data('filter'); 1203 activateFilter(filtro); 1204 }); 1205 1206 const hash = window.location.hash.replace('#', ''); 1207 if (hash) {
1208 activateFilter(hash); 1209 } else { 1210 activateFilter('*'); 1211 } 1212 1213 iso.on('arrangeComplete', function () { 1214 refreshAOS(); 1215 }); 1216 } 1217 1218 if ($("body").hasClass("page-template-template-socios-fotografos")) { 1219 // SMOOTH SCROLL MENÃ 1220 $('.menu-secciones').on('click', 'a[href^="#"]', function(e){ 1221 var hash = this.hash; 1222 var target = document.getElementById(hash.slice(1)); 1223 if (!target) return; // ignore external or missing 1224 1225 e.preventDefault(); 1226 1227 if (window.lenis && typeof window.lenis.scrollTo === 'function') { 1228 lenis.scrollTo(target, { offset: offsetSmoothScroll }); 1229 } else { 1230 $('html, body').animate({ 1231 scrollTop: $(target).offset().top - offsetSmoothScroll 1232 }, 600); 1233 } 1234 1235 history.pushState(null, null, hash); 1236 }); 1237 1238 // SLIDER NOTICIAS SOCIOS 1239 const swiperNoticias = new Swiper('.sec-novedades .galeria-destacadas .swiper', { 1240 direction: 'horizontal', 1241 loop: true, 1242 fadeEffect: { 1243 crossFade: true 1244 }, 1245 effect: "fade", 1246 autoplay: { 1247 delay: 6000, 1248 }, 1249 speed: 1000, 1250 pagination: { 1251 el: '.sec-novedades .galeria-destacadas .swiper-pagination', 1252 clickable: true, 1253 } 1254 }); 1255 1256 igualarAlturaNoticiasSocios(); 1257 1258 /* SLIDER SOCIOS */ 1259 var splideColaboradores = new Splide('.sec-directorio .splide', { 1260 type: 'loop', 1261 drag: 'free', 1262 focus: 'center', 1263 autoWidth: true, 1264 gap: '2em', 1265 arrows: false, 1266 pagination: false, 1267 autoScroll: { 1268 speed: -0.5, 1269 pauseOnHover: false, 1270 pauseOnFocus: false, 1271 }, 1272 breakpoints: { 1273 600: { 1274 gap: '1em', 1275 } 1276 } 1277 }); 1278 1279 splideColaboradores.mount(window.splide.Extensions); 1280 } 1281 1282 if ($("body").hasClass("single-socio")) { 1283 // SLIDER GALERÃA 1284 const swiperGaleria = new Swiper('.galeria .swiper', { 1285 direction: 'horizontal', 1286 loop: true, 1287 fadeEffect: { 1288 crossFade: true 1289 }, 1290 effect: "fade", 1291 autoplay: { 1292 delay: 6000, 1293 }, 1294 speed: 1000, 1295 pagination: { 1296 el: '.galeria .swiper-pagination', 1297 clickable: true, 1298 }, 1299 navigation: { 1300 nextEl: '.galeria .swiper-button-next', 1301 prevEl: '.galeria .swiper-button-prev', 1302 }, 1303 }); 1304 1305 /* SLIDER OTROS */ 1306 var splideColaboradores = new Splide('.sec-otros .splide', { 1307 type: 'loop', 1308 drag: 'free', 1309 focus: 'center', 1310 autoWidth: true, 1311 gap: '2em', 1312 arrows: false, 1313 pagination: false, 1314 autoScroll: { 1315 speed: -0.5, 1316 pauseOnHover: false, 1317 pauseOnFocus: false, 1318 }, 1319 breakpoints: { 1320 600: { 1321 gap: '1em', 1322 } 1323 } 1324 }); 1325 1326 splideColaboradores.mount(window.splide.Extensions); 1327 } 1328 1329 if ($("body").hasClass("page-template-template-unete")) { 1330 /* DESPLEGABLE VENTAJAS */ 1331 $('.sec-detalles .btn-mas').click(function(){ 1332 $(this).toggleClass('on'); 1333 $(this).siblings('.ventajas').slideToggle(); 1334 refreshAOS(); 1335 }); 1336 } 1337 1338 if ($("body").hasClass("page-template-template-actualidad")) { 1339 const grid = $('.listado-noticias'); 1340 const iso = new Isotope(grid[0], { 1341 itemSelector: '.caja-noticia', 1342 layoutMode: 'masonry', 1343 transitionDuration: 0, 1344 }); 1345 1346 const botones = $('.filtros .btn-filtro'); 1347 1348 function activateFilter(slug) { 1349 const $activeBtn = $(`.btn-filtro[data-filter="${slug}"]`); 1350 1351 if ($activeBtn.hasClass('on')) { 1352 iso.arrange({ filter: '*' }); 1353 botones.removeClass('on'); 1354 history.replaceState(null, null, window.location.pathname); 1355 } else { 1356 iso.arrange({ filter: '.' + slug }); 1357 botones.removeClass('on'); 1358 $activeBtn.addClass('on'); 1359 history.replaceState(null, null, '#' + slug); 1360 } 1361 1362 refreshAOS(); 1363 } 1364 1365 botones.on('click', function () { 1366 const filtro = $(this).data('filter'); 1367 activateFilter(filtro); 1368 }); 1369 1370 $('.listado-noticias').on('click', '.btn-categoria', function (e) { 1371 e.preventDefault(); 1372 const slug = $(this).data('term'); 1373 activateFilter(slug); 1374 }); 1375 1376 const hash = window.location.hash.replace('#', ''); 1377 if (hash) { 1378 activateFilter(hash); 1379 } 1380 1381 iso.on('arrangeComplete', function () { 1382 refreshAOS(); 1383 }); 1384 } 1385 } 1386
1387 $(document).ready(function(){ 1388 actions(); 1389 setTopImgHomeVar(); 1390 alturaEducacion(); 1391 ajustarAnchoFigcaption(); 1392 matchTituloHeights(); 1393 $("body").addClass("ready"); 1394 }); 1395 1396 $(window).resize(function(){ 1397 setTimeout(function() { 1398 setTopImgHomeVar(); 1399 alturaEducacion(); 1400 igualarAlturaNoticiasSocios(); 1401 ajustarAnchoFigcaption(); 1402 igualarAlturaOtros(); 1403 matchTituloHeights(); 1404 }, 200); 1405 refreshAOS(); 1406 }); 1407 1408 $(window).on('scroll', function() { 1409 }); 1410 1411 $(window).load(function(){ 1412 $("body").addClass("loaded"); 1413 }); 1414 1415 function refreshAOS() { 1416 setTimeout(() => { 1417 AOS.refresh(); 1418 }, 500); 1419 } 1420 1421 function abreMenu() { 1422 menuAbriendose = true; 1423 1424 $("body").addClass("menuDesktopOpen"); 1425 $("html").addClass("menuDesktopOpen"); 1426 1427 setTimeout(function () { 1428 menuAbriendose = false; 1429 //alert('acabao'); 1430 }, 400); 1431 1432 }; 1433 1434 function cierraMenu() { 1435 menuAbriendose = false; 1436 1437 $("body").removeClass("menuDesktopOpen"); 1438 $("html").removeClass("menuDesktopOpen"); 1439 }; 1440 1441 function setTopImgHomeVar() { 1442 if ($("body").hasClass("page-template-template-home")){ 1443 var $img = $('.sec-intro .top figure img').first(); 1444 if (!$img.length) return; 1445 1446 // ancho renderizado (incluye padding/border si los hubiera) 1447 var w = Math.round($img.outerWidth()); 1448 document.documentElement.style.setProperty('--top-img-w', w + 'px'); 1449 } 1450 } 1451 1452 function matchTituloHeights() { 1453 if ($("body").is(".page-template-template-fundacion, .page-template-template-equipo, .page-template-template-accion-social, .page-template-template-apoyo, .page-template-template-comunidad")) { 1454 const winWidth = $(window).width(); 1455 1456 if (winWidth <= 600) return; // Skip for small screens 1457 1458 const itemsPerRow = winWidth > 1000 ? 3 : 2; 1459 1460 // Loop through each .listado section separately 1461 $('.listado-equipo').each(function () { 1462 const $container = $(this); 1463 const $items = $container.find('.caja-equipo'); 1464 1465 // Reset all heights 1466 $items.find('.titulo').css('min-height', ''); 1467 1468 // Group and set heights per row 1469 for (let i = 0; i < $items.length; i += itemsPerRow) { 1470 const row = $items.slice(i, i + itemsPerRow); 1471 let maxHeight = 0; 1472 1473 row.each(function () { 1474 const h = $(this).find('.titulo').outerHeight(true); 1475 if (h > maxHeight) maxHeight = h; 1476 }); 1477 1478 row.each(function () { 1479 $(this).find('.titulo').css('min-height', maxHeight + 'px'); 1480 }); 1481 } 1482 }); 1483 } 1484 } 1485 1486 function ajustarAnchoFigcaption() { 1487 if ($("body").is(".single-libro, .page-template-template-fundacion")) { 1488 $('.caja-libro figcaption').css('width', 'auto'); 1489 1490 $('.caja-libro').each(function () { 1491 var $img = $(this).find('img'); 1492 var $caption = $(this).find('figcaption'); 1493 1494 if ($img.length && $caption.length) { 1495 var imgWidth = $img.outerWidth(); 1496 if (imgWidth > 0) { 1497 $caption.css('width', imgWidth + 'px'); 1498 } 1499 } 1500 }); 1501 } 1502 } 1503 1504 function alturaEducacion() { 1505 if ($("body").hasClass("page-template-template-accion-social")){ 1506 var initialHeight = $('.opciones').outerHeight(); 1507 $('.opciones').height(initialHeight); 1508 } 1509 } 1510 1511 function igualarAlturaOtros() { 1512 if ($("body").is(".single-asesoria, .single-formacion")){ 1513 var maxHeight = 0; 1514 $('.sec-otros .swiper-slide figcaption').css('height', 'auto'); 1515 1516 $('.sec-otros .swiper-slide figcaption').each(function() { 1517 var altura = $(this).outerHeight(); 1518 if (altura > maxHeight) maxHeight = altura; 1519 }); 1520 1521 $('.sec-otros .swiper-slide figcaption').css('height', maxHeight + 'px'); 1522 } 1523 } 1524 1525 function igualarAlturaNoticiasSocios() { 1526 var $cajas = $('.galeria-destacadas .caja-noticia'); 1527 var maxAltura = 0; 1528 1529 $cajas.css('height', 'auto'); 1530 $cajas.each(function() { 1531 var altura = $(this).outerHeight(); 1532 if (altura > maxAltura) { 1533 maxAltura = altura; 1534 } 1535 }); 1536 1537 $cajas.css('height', maxAltura + 'px'); 1538 refreshAOS(); 1539 } 1540 1541})( jQuery );
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.