1equalheight = function(container){ 2 3 var anchura_navegador = $(window).width(); 4 if(anchura_navegador>600) 5 { 6 var currentTallest = 0, 7 currentRowStart = 0, 8 rowDivs = new Array(), 9 $el, 10 topPosition = 0; 11 $(container).each(function() { 12 13 $el = $(this); 14 $($el).height('auto') 15 topPostion = $el.position().top; 16 17 if (currentRowStart != topPostion) { 18 for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 19 rowDivs[currentDiv].height(currentTallest); 20 } 21 rowDivs.length = 0; // empty the array 22 currentRowStart = topPostion; 23 currentTallest = $el.height(); 24 rowDivs.push($el); 25 } else { 26 rowDivs.push($el); 27 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 28 } 29 for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 30 rowDivs[currentDiv].height(currentTallest); 31 } 32 }); 33 } 34} 35 36 37$.fn.firstWord = function() { 38 var text = this.text().trim().split(" "); 39 var first = text.shift(); 40 this.html((text.length > 0 ? "<span class='firstWord'>"+ first + "</span> " : first) + text.join(" ")); 41}; 42 43$(window).load(function() { 44 equalheight('.igual_altura'); 45 equalheight('.igual_altura2'); 46 equalheight('.igual_altura3'); 47 equalheight('.cuadricula-imagenes .col'); 48}); 49 50 51$(window).resize(function(){ 52 equalheight('.igual_altura'); 53 equalheight('.igual_altura2'); 54 equalheight('.igual_altura3'); 55 equalheight('.cuadricula-imagenes .col'); 56}); 57 58 59$( document ).ready(function() 60{ 61 62 63 /*------------------------------------------------------------------------------------------ 64 VERSIÃN 2 DEL TEMA DE DIPCAS 65 --------------------------------------------------------------------------------------------*/ 66 67 //---> DESTACADOS HOME 68 var mySwiper = new Swiper ('.swiper-destacados-home', { 69 // Optional parameters 70 direction: 'horizontal', 71 loop: false, 72 speed: 1200, 73 grabCursor: true, 74 pagination: { 75 el: ".swiper-pagination", 76 clickable: true 77 } 78 }); 79 80 //---> VIDEOS HOME 81 var mySwiper = new Swiper ('.swiper-videos-home', { 82 // Optional parameters 83 direction: 'horizontal', 84 loop: false, 85 speed: 1200, 86 grabCursor: true, 87 // Navigation arrows 88 navigation: { 89 nextEl: '.swiper-button-next', 90 prevEl: '.swiper-button-prev', 91 }, 92 93 on: { 94 slideChangeTransitionStart: function () { 95 // Slide captions 96 var swiper = this; 97 var slideTitle = $(swiper.slides[swiper.activeIndex]).attr("data-title"); 98 $(".videos-home .col-txt .titulo").html(slideTitle); 99 } 100 } 101 }); 102 103 104 105 /*------------------------------------------------------------------------------------------ 106 FIN VERSIÃN 2 DEL TEMA DE DIPCAS 107 --------------------------------------------------------------------------------------------*/ 108 109 //--> FULL SLIDESHOW 110 if(('.mouse-scroll').length>0) 111 { 112 setInterval(function(){ 113 $('.mouse-scroll .flecha').toggleClass('bajo'); 114 }, 800); 115 116 $('.mouse-scroll').click(function() 117 { 118 $('html, body').animate( 119 { 120 scrollTop: $('.layout-content.pagina').offset().top 121 }, 1000); 122 }); 123 124 var new_effect=3; 125 var old_effect; 126 127 $('.cycle-slideshow.slide-full div:first-child').addClass('scale'); 128 $('.cycle-slideshow.slide-full div:first-child').addClass('fx' + new_effect); 129 130 $('.cycle-slideshow.slide-full').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 131 old_effect = new_effect; 132 new_effect = 3; 133 $(incomingSlideEl).addClass('scale'); 134 $(incomingSlideEl).addClass('fx' + new_effect); 135 }); 136 137 $('.cycle-slideshow.slide-full').on('cycle-after', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 138 $(outgoingSlideEl).removeClass('scale'); 139 $(outgoingSlideEl).removeClass('fx' + old_effect); 140 }); 141 142 143 } 144 145 if($('.contenido-covid .tab-widget').length>0) 146 { 147 $('.tab-widget__tabs').slimScroll({ 148 position: 'right', 149 height: '500px', 150 railVisible: true, 151 alwaysVisible: true, 152 color: '#c00c37', 153 distance: '20px', 154 railColor: '#999', 155 }); 156 157 158 $('.contenedor-noticias-grid3 .titulo-noticias-grid span').remove(); 159 } 160 161 $('.editable').removeAttr('title'); 162 163 164 $('body.publico').find("[contenteditable='true']").each(function() 165 { 166 $(this).removeAttr("contenteditable"); 167 });
168 169 if($('.destacados-libreta .slick_slide_libreta').length>0) 170 { 171 $('.slick_slide_libreta').slick({ 172 infinite: true, 173 slidesToShow: 3, 174 autoplay:true, 175 dots: true, 176 autoplaySpeed:5000, 177 slidesToScroll: 1, 178 arrows: false, 179 responsive: [ 180 { 181 breakpoint: 1020, 182 settings: { 183 slidesToShow: 2, 184 slidesToScroll: 1, 185 autoplay:true, 186 dots: true, 187 autoplaySpeed:6000, 188 infinite: true, 189 arrows: false, 190 } 191 }, 192 { 193 breakpoint: 768, 194 settings: { 195 slidesToShow: 1, 196 slidesToScroll: 1, 197 infinite: true, 198 dots: true, 199 arrows: false, 200 prevArrow: '<button type="button" class="slick-prev"></button>', 201 nextArrow: '<button type="button" class="slick-next"></button>', 202 } 203 } 204 ] 205 }); 206 } 207 208 209 /*------------------------------------------------------------------ 210 BUSCADOR DE ÃREAS Y ENTIDADES 211 --------------------------------------------------------------------*/ 212 $('.buscador-areas').on('keyup', function(e) { 213 214 var sSearch = this.value; 215 216 var data = { 217 q: sSearch 218 }; 219 var url = BASE_HOST + AUTO_LANGUAGE + '/corporacion/public/buscar_areas'; 220 $.ajax({
221 type: "POST", 222 url: url, 223 data: data, 224 success: function(data) 225 { 226 $('.listado-areas').html(data); 227 228 } 229 }); 230 231 232 233 }); 234 235 /*------------------------------------------------------------------ 236 MODULO GALERIAS 237 --------------------------------------------------------------------*/ 238 // --> VER LA GALERIA 239 $(document).on("click", '.ver-galeria', function(event) 240 { 241 var id_galeria = $(this).attr('data-idgaleria'); 242 $('.contenido-fotografias-' + id_galeria).fadeIn(300); 243 244 }); 245 // --> VOLVER AL LISTADO DE CATEGORÃAS DE LA GALERIA 246 $(document).on("click", '.volver-galeria', function(event) 247 { 248 $(this).parent().fadeOut(300); 249 250 }); 251 252 253 254 $(document).on('click', 'a.smooth-scroll[href^="#"]', function (e) { 255 e.preventDefault(); 256 257 $('html, body').animate({ 258 scrollTop: $($.attr(this, 'href')).offset().top 259 }, 500); 260 }); 261 262 if($('.sldr').length>0) 263 { 264 $('.sldr').each(function () { 265 var th = $(this); 266 th.sldr({ 267 focalClass: 'focalPoint', 268 offset: th.width() / 2, 269 sldrWidth: 'responsive', 270 nextSlide: th.nextAll('.sldr-nav.next:first'), 271 previousSlide: th.nextAll('.sldr-nav.prev:first'), 272 selectors: th.nextAll('.selectors:first').find('li'), 273 toggle: th.nextAll('.captions:first').find('div'), 274 sldrAuto: true, 275 sldrTime: 5000, 276 hasChange: true 277 }); 278 }); 279 } 280 281 282 if($('.slick_slide_agenda').length>0) 283 { 284 $('.slick_slide_agenda').slick({ 285 infinite: true, 286 slidesToShow: 4, 287 slidesToScroll: 4, 288 arrows: true, 289 prevArrow: '<button type="button" class="slick-prev"></button>', 290 nextArrow: '<button type="button" class="slick-next"></button>', 291 responsive: [ 292 { 293 breakpoint: 1200, 294 settings: { 295 slidesToShow: 2, 296 slidesToScroll: 2, 297 infinite: true, 298 arrows: true, 299 prevArrow: '<button type="button" class="slick-prev"></button>', 300 nextArrow: '<button type="button" class="slick-next"></button>', 301 } 302 }, 303 { 304 breakpoint: 768, 305 settings: { 306 slidesToShow: 1, 307 slidesToScroll: 1, 308 infinite: true, 309 arrows: true, 310 prevArrow: '<button type="button" class="slick-prev"></button>', 311 nextArrow: '<button type="button" class="slick-next"></button>', 312 } 313 } 314 ] 315 }); 316 } 317 318 319 setTimeout(function(){ 320 321 $('#cont_8db4f50508ea1c48a421ef765a36bf5f').css({'margin': 0,'margin-top':'-12px','background-color':'#D0D0D0'}); 322 $('iframe #BwG').css({'background-color':'#D0D0D0 !important'}); 323 324 }, 1000) 325 326 327 // VALIDACIÃN DE LOS FORMULARIOS 328 $('.form-envio-formulario').each(function() 329 { 330 var formulario = $(this); 331 $(this).validate({ 332 invalidHandler: function(event, validator) { 333 // 'this' refers to the form 334 var errors = validator.numberOfInvalids(); 335 if (errors) 336 { 337 $('.preloader-formulario').hide(); 338 $('.form-envio-formulario .btn-enviar').show(); 339 } 340 } 341 }); 342 }); 343 344 345 $('.form-envio-formulario .btn-enviar').click(function() 346 { 347 $('.preloader-formulario').show(); 348 $(this).hide(); 349 }); 350 351 352 353 354 $('.selector-fecha').datepicker( 355 { 356 beforeShow: function(input, inst) 357 { 358 $('#ui-datepicker-div').addClass('datepicker-fecha'); 359 }, 360 changeMonth: true, 361 changeYear: true, 362 yearRange: "-20:+0", 363 monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', '
363Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], 364 monthNamesShort: ['Ene','Feb','Mar','Abr', 'May','Jun','Jul','Ago','Sep', 'Oct','Nov','Dic'], 365 dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'], 366 dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], 367 dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'], 368 dateFormat: 'dd/mm/yy', 369 weekHeader: 'Sm', 370 firstDay: 1, 371 }); 372 373 374 // Cuenta atrás 375 376 if(('#cuenta-atras').length>0) 377 { 378 $("#cuenta-atras") 379 .countdown("2018/05/12 07:00:00", function(event) { 380 $(this).html( 381 event.strftime('' 382 + '<div class="col-cuenta">%-m <span>meses</span></div>' 383 + '<div class="col-cuenta">%-n <span>dÃas</span></div>' 384 + '<div class="col-cuenta">%H <span>horas</span></div>' 385 + '<div class="col-cuenta">%M <span>minutos</span></div>' 386 + '<div class="col-cuenta">%S <span>segundos</span></div>' 387 ) 388 ); 389 }); 390 } 391 392 393 // Slick slider lateral 394 395 $('.lateral-destacados-resp').slick({ 396 // dots: false, 397 infinite: true, 398 // centerMode: true, 399 slidesToShow: 1, 400 slidesToScroll: 1, 401 // centerPadding: '220px', 402 arrows: true, 403 prevArrow: '<button type="button" data-role="none" class="slick-prev slick-arrow" aria-label="Previous" role="button" style="display: block;"><i class="fa fa-chevron-left" aria-hidden="true"></i></button>', 404 nextArrow: '<button type="button" data-role="none" class="slick-next slick-arrow" aria-label="Next" role="button" style="display: block;"><i class="fa fa-chevron-right" aria-hidden="true"></i></button>', 405 responsive: [ 406 { 407 breakpoint: 768, 408 settings: { 409 slidesToShow: 2, 410 slidesToScroll: 2, 411 infinite: true 412 } 413 }, 414 { 415 breakpoint: 668, 416 settings: { 417 slidesToShow: 1, 418 slidesToScroll: 1, 419 infinite: true 420 } 421 }, 422 ] 423 }); 424 425 $.widget.bridge('uitooltip', $.ui.tooltip); 426 427 $('[data-toggle="tooltip"]').tooltip(); 428 429 $('.gallery-item').magnificPopup({ 430 type: 'image', 431 gallery:{ 432 enabled:true 433 } 434 }); 435 436 $('.img-magnific').magnificPopup({ 437 type: 'image', 438 gallery:{ 439 enabled:false 440 } 441 }); 442 443 $('.popup-player').magnificPopup({ 444 type: 'iframe', 445 mainClass: 'mfp-fade', 446 removalDelay: 160, 447 preloader: false, 448 fixedContentPos: true, 449 iframe: { 450 markup: '<div class="mfp-iframe-scaler">'+ 451 '<div class="mfp-close"></div>'+ 452 '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+ 453 '</div>', 454 455 srcAction: 'iframe_src', 456 } 457 }); 458 459 $('.ajax-popup-link').magnificPopup({ 460 type: 'ajax' 461 }) 462 463 464 $('#myCarousel').carousel({ 465 interval: 0 466 }) 467 468 469 $('.menu ul').slicknav({ 470 label: '', 471 prependTo:'.cabecera-inferior' 472 }); 473 474 475 /*------------------------------------------------------------------------------------------ 476 MENU RESPONSIVE 477 --------------------------------------------------------------------------------------------*/ 478 $('label.icon').click(function(){ 479 480 $('.menu-responsive').toggleClass('abierto'); 481 $('body').toggleClass('abierto'); 482 483 }); 484 485 /*------------------------------------------------------------------------------------------ 486 CABECERA FIJA EN RESPONSIVE 487 --------------------------------------------------------------------------------------------*/ 488 $(window).scroll(function() 489 { 490 var sticky = $('.cabecera'), 491 scroll = $(window).scrollTop(); 492 493 if (scroll >= 130) sticky.addClass('fixed'); 494 else sticky.removeClass('fixed'); 495 });
496 /*------------------------------------------------------------------------------------------ 497 ALERTAS 498 --------------------------------------------------------------------------------------------*/ 499 if($('.alerta-popup').length>0) 500 { 501 setTimeout(function() 502 { 503 $('.alerta-popup').addClass('abierto'); 504 }, 1500); 505 } 506 $('.cerrar-alerta').click(function() 507 { 508 var id_alerta = $(this).attr('data-id'); 509 $.cookie("alerta_" + id_alerta, 1, { expires : 3, path : '/'}); 510 $('.alerta-popup').slideUp(200); 511 }); 512 513 514 $('.tab-widget__link').click(function() 515 { 516 517 //--> CAMB 518 519 equalheight('.igual_altura'); 520 equalheight('.igual_altura2'); 521 equalheight('.igual_altura3'); 522 equalheight('.cuadricula-imagenes .col'); 523 524 setTimeout(function(){ 525 526 equalheight('.igual_altura'); 527 equalheight('.igual_altura2'); 528 equalheight('.igual_altura3'); 529 equalheight('.cuadricula-imagenes .col'); 530 531 }, 1000); 532 533 setTimeout(function(){ 534 535 equalheight('.igual_altura'); 536 equalheight('.igual_altura2'); 537 equalheight('.igual_altura3'); 538 equalheight('.cuadricula-imagenes .col'); 539 540 }, 3000); 541 542 }); 543 544 545 546 547 $('.btn-buscar-movil-eventos').click(function() 548 { 549 if($(this).hasClass('activo')) 550 { 551 $('.fila-buscador').css({'bottom': '-435px'}); 552 $(this).removeClass('activo'); 553 } 554 else 555 { 556 $('.fila-buscador').css({'bottom': '0'}); 557 $(this).addClass('activo'); 558 } 559 560 }); 561 562 $('.btn-buscar-movil-eventos-mapa').click(function() 563 { 564 if($(this).hasClass('activo')) 565 { 566 $('.fila-buscador').css({'bottom': '-420px'}); 567 $(this).removeClass('activo'); 568 } 569 else 570 { 571 $('.fila-buscador').css({'bottom': '0'}); 572 $(this).addClass('activo'); 573 } 574 575 }); 576 577 $('.btn-buscar-movil-posts').click(function() 578 { 579 if($(this).hasClass('activo')) 580 { 581 $('.fila-buscador').css({'bottom': '-300px'}); 582 $(this).removeClass('activo'); 583 } 584 else 585 { 586 $('.fila-buscador').css({'bottom': '0'}); 587 $(this).addClass('activo'); 588 } 589 }); 590 591 $('.btn-buscar-movil-competiciones,.btn-buscar-movil-embajadores').click(function() 592 { 593 if($(this).hasClass('activo')) 594 { 595 $('.fila-buscador').css({'bottom': '-170px'}); 596 $(this).removeClass('activo'); 597 } 598 else 599 { 600 $('.fila-buscador').css({'bottom': '0'}); 601 $(this).addClass('activo'); 602 } 603 }); 604 605 // RESPONSIVE SLIDES 606 var an_pantalla = $(window).width(); 607 if($('.cycle-slideshow').length>0 && an_pantalla<600 ) 608 { 609 $('.item-home').each(function() 610 { 611 var img_responsive = $(this).attr('data-img-responsive'); 612 $(this).css("background-image", "url("+img_responsive+")"); 613 }); 614 } 615 616 $("[contenteditable='true']").each(function() { 617 $(this).removeAttr("contenteditable"); 618 }); 619 620 621 $('.titulo-acordeon').click(function() 622 { 623 $(this).parent().find('.cuerpo-acordeon').slideToggle(); 624 $(this).toggleClass('abierto'); 625 setTimeout(function(){ equalheight('.igual_altura'); }, 400); 626 setTimeout(function(){ equalheight('.igual_altura'); }, 1100); 627 }); 628 629 $('.boton-busqueda,.btn-buscador').click(function() 630 { 631 if($(this).hasClass('abierto')) 632 { 633 $('.contenedor-busqueda').fadeOut(400); 634 $('body').css({'overflow' : 'visible'}); 635 } 636 else 637 { 638 $('.contenedor-busqueda').fadeIn(500); 639 $('body').css({'overflow' : 'hidden'}); 640 } 641 }); 642 643 $('.contenedor-busqueda .cerrar').click(function() 644 { 645 $('.contenedor-busqueda').fadeOut(400); 646 $('body').css({'overflow' : 'visible'}); 647 });
648 649 $('ul.tab-widget__list li').click(function(){ 650 equalheight('.igual_altura'); 651 setTimeout(function(){ equalheight('.igual_altura'); }, 800); 652 653 }); 654 655 $('.tabla-ordenable').dataTable({ 656 "language": { 657 "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json" 658 }, 659 paging: false, 660 responsive: true, 661 "aaSorting": [] 662 }); 663 664 $('.tabla-ordenable-formacion').dataTable({ 665 "language": { 666 "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json" 667 }, 668 paging: true, 669 pageLength: 20, 670 responsive: true, 671 "aaSorting": [] 672 }); 673 674 675 676 677 678 $(".calendario-competiciones .titulo-mas").firstWord(); 679 $(".listado-noticias .titulo-mas").firstWord(); 680 $("h2.subtitulo").firstWord(); 681 682/* GALERIA WORKS */ 683 684 $('.works_detalle .slick_proyectos').slick({ 685 centerMode: true, 686 centerPadding: '60px', 687 dots: false, 688 infinite: true, 689 speed: 300, 690 slidesToShow: 4, 691 slidesToScroll: 1, 692 focusOnSelect: true, 693 responsive: [ 694 { 695 breakpoint: 1024, 696 settings: { 697 slidesToShow: 1, 698 slidesToScroll: 1, 699 infinite: true, 700 dots: false 701 } 702 }, 703 { 704 breakpoint: 600, 705 settings: { 706 slidesToShow: 2, 707 slidesToScroll: 1, 708 dots: false 709 } 710 }, 711 { 712 breakpoint: 480, 713 settings: { 714 centerMode: false, 715 slidesToShow: 1, 716 slidesToScroll: 1, 717 dots: false 718 } 719 } 720 // You can unslick at a given breakpoint now by adding: 721 // settings: "unslick" 722 // instead of a settings object 723 ] 724 }); 725 726 /* Ajax GALERIA WORKS */ 727 $('.slick_proyectos').on('click','.proy_rest', function (){ 728 var id_prod = $(this).attr("data-id"); 729 var data = { 730 id_prod: id_prod 731 }; 732 var url = BASE_HOST+AUTO_LANGUAGE + '/works/public/cargar_works_ajax'; 733 $.ajax({
734 type: "POST", 735 url: url, 736 data: data, 737 success: function(data) 738 { 739 $('.works_detalle .ficha_producto').empty(); 740 if(!$(".works_detalle .ficha_producto").hasClass("triggered")){ 741 $('.works_detalle .ficha_producto').html(data); 742 $('.works_detalle .ficha_producto').slideDown(800); 743 $('.works_detalle .ficha_producto').addClass("triggered"); 744 745 $('.works_detalle .cycle-slideshow').cycle({ 746 speed: 600, 747 manualSpeed: 100 748 }); 749 750 }else{ 751 $('.works_detalle .ficha_producto').hide().html(data).fadeIn("slow"); 752 753 $('.works_detalle .cycle-slideshow').cycle({ 754 speed: 600, 755 manualSpeed: 100 756 }); 757 } 758 $('.works_detalle .small').hide(); 759 // Igualamos altura 760 setTimeout(function() 761 { 762 $('.layout-right-col').css({'height': 'auto'}); 763 equalheight('.igual_altura'); 764 $('html, body').animate({ 765 scrollTop: $('.ancla_proyectos').offset().top 766 }, 400); 767 }, 900); 768 769 } 770 }); 771 772 773 }); 774 775 776 setTimeout(function(){ 777 778 equalheight('.igual_altura'); 779 equalheight('.igual_altura2'); 780 equalheight('.igual_altura3'); 781 equalheight('.cuadricula-imagenes .col'); 782 783 }, 1500) 784 785}); 786 787 788(function (document, window, $, undefined) { 789 'use strict'; 790 791 var $tabWidget = $('.js-tab-widget'); 792 793 var setupTabs = function($tab, $allTabs, $tabPanels, $tabListItems, i) { 794 $tab 795 .attr({ 796 'id': 'tab-link-' + i, 797 'tabindex': '-1', 798 'role': 'tab', 799 'aria-selected': 'false', 800 'aria-controls': 'tab-panel-' + i 801 }); 802 803 if (i === 0) 804 { 805 $tab 806 .attr({ 807 'tabindex': '0', 808 'aria-selected': 'true', 809 'aria-describedby': 'tab-widget-description' 810 }) 811 .addClass('tab-widget__link--active'); 812 813 $tab.parent().toggleClass('tab_li_activo'); 814 } 815 816 $tab.on('click', function(e) 817 { 818 var url = $(this).attr('href'); 819 if(url.indexOf('http') !== -1) 820 { 821 822 } 823 else 824 { 825 e.preventDefault(); 826 tabClick($(this), $allTabs, $tabPanels, i); 827 } 828 }); 829 830 $tab.on('focus', function(e) 831 { 832 var url = $(this).attr('href'); 833 if(url.indexOf('http') !== -1) 834 { 835 836 } 837 else 838 { 839 tabClick($(this), $allTabs, $tabPanels, i); 840 } 841 }); 842 843 $tab.on('keydown', function (e) 844 { 845 var url = $(this).attr('href'); 846 if(url.indexOf('http') !== -1) 847 { 848 849 } 850 else 851 { 852 tabKeydown($(this), $allTabs, $tabPanels, $tabListItems, i, e); 853 } 854 }); 855 }; 856 857 var setupTabPanels = function(tabPanel, i) { 858 tabPanel 859 .attr({ 860 'id': 'tab-panel-' + i, 861 'role': 'tabpanel', 862 'aria-hidden': 'true', 863 'aria-labelledby': 'tab-link-' + i 864 }); 865 866 if (i === 0) { 867 tabPanel 868 .attr('aria-hidden', 'false') 869 .addClass('tab-widget__tab-content--active'); 870 } 871 }; 872 873 var tabClick = function($thisTab, $allTabs, $tabPanels, i) { 874 $allTabs 875 .attr({ 876 'tabindex': -1, 877 'aria-selected': 'false' 878 }) 879 .removeAttr('aria-describedby') 880 .removeClass('tab-widget__link--active'); 881 882 $thisTab 883 .attr({ 884 'tabindex': 0, 885 'aria-selected': 'true', 886 'aria-describedby': 'tab-widget-description' 887 }) 888 .addClass('tab-widget__link--active'); 889 890 $thisTab.parent().parent().find('.tab_li_activo').removeClass('tab_li_activo'); 891 $thisTab.parent().addClass('tab_li_activo'); 892 893 $tabPanels 894 .attr('aria-hidden', 'true') 895 .removeClass('tab-widget__tab-content--active'); 896 897 $tabPanels.eq(i) 898 .attr('aria-hidden', 'false') 899 .addClass('tab-widget__tab-content--active'); 900 }; 901 902 var tabKeydown = function($thisTab, $allTabs, $tabPanels, $tabListItems, i, e) { 903 var keyCode = e.which, 904 $nextTab = $thisTab.parent().next().is('li') ? $thisTab.parent().next().find('a') : false, 905 $previousTab = $thisTab.parent().prev().is('li') ? $thisTab.parent().prev().find('a') : false, 906 $firstTab = $thisTab.parent().parent().find('li:first').find('a'), 907 $lastTab = $thisTab.parent().parent().find('li:last').find('a'); 908 909 switch(keyCode) { 910 // Left/Up 911 case 37: 912 case 38: 913 e.preventDefault(); 914 e.stopPropagation(); 915 916 if (!$previousTab) { 917 $lastTab.focus(); 918 } else { 919 $previousTab.focus(); 920 } 921 922 break; 923 924 // Right/Down 925 case 39: 926 case 40: 927 e.preventDefault(); 928 e.stopPropagation(); 929 930 if (!$nextTab) { 931 $firstTab.focus(); 932 } else { 933 $nextTab.focus(); 934 } 935 936 break; 937 938 // Home 939 case 36: 940 e.preventDefault(); 941 e.stopPropagation(); 942 943 $firstTab.focus(); 944 945 break; 946 947 // End 948 case 35: 949 e.preventDefault(); 950 e.stopPropagation(); 951 952 $lastTab.focus(); 953 954 break; 955 956 // Enter/Space 957 case 13: 958 case 32: 959 e.preventDefault(); 960 e.stopPropagation(); 961 962 break; 963 } 964 }; 965 966 $tabWidget.each(function () { 967 var $this = $(this), 968 $tabList = $this.find('> ul'), 969 $tabListItems = $tabList.find('li'), 970 $allTabs = $tabListItems.find('a'), 971 $tabPanels = $this.find('> div > div'); 972 973 $tabList.attr('role', 'tablist'); 974 $tabListItems.attr('role', 'presentation'); 975 976 $allTabs.each(function (i) { 977 setupTabs($(this), $allTabs, $tabPanels, $tabListItems, i); 978 }); 979 980 $tabPanels.each(function (i) { 981 setupTabPanels($(this), i); 982 }); 983 });
984 985 $('html').addClass('js').removeClass('no-js'); 986 987})(document, window, 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.