1/*Control scroll adserver lateral - interna*/ 2(function ($) { 3 $(document).ready(function () { 4 const $bloque = $('.revive-flotante-scroll'); 5 const $mainContent = $('#block-marca-pais-content'); 6 7 const startOffset = 900; 8 const endOffset = 700; 9 10 if ($bloque.length && $mainContent.length) { 11 setTimeout(function () { 12 const $imagen = $bloque.find('img'); 13 14 if ($imagen.length) { 15 const checkVisibility = function () { 16 const viewportTop = $(window).scrollTop(); 17 const viewportBottom = viewportTop + $(window).height(); 18 19 const contentTop = $mainContent.offset().top + startOffset; 20 const contentBottom = $mainContent.offset().top + $mainContent.outerHeight() - endOffset; 21 22 if (viewportBottom > contentTop && viewportTop < contentBottom) { 23 $imagen 24 .css({ display: 'block', visibility: 'visible', opacity: 1 }) 25 .removeClass('hidden invisible d-none'); 26 } else { 27 $imagen.hide(); 28 } 29 }; 30 31 $(window).on('scroll', checkVisibility); 32 checkVisibility(); 33 } 34 }, 1000); 35 } else { 36 console.warn('No se encontró el bloque del contenido principal.'); 37 } 38 }); 39})(jQuery); 40 41/*Control botón cerrar adserver flotante - home*/ 42(function ($) { 43 $(document).ready(function () { 44 if ($('.revive-flotante.banner-adserver').length !== 0) { 45 $('.revive-flotante.banner-adserver').each(function () { 46 if ($(this).find('.adserver-close-button-float').length === 0) { 47 $(this).append("<div class='adserver-close-button-float'></div>"); 48 $(this).find('.adserver-close-button-float').text(''); 49 } 50 }); 51 } 52 53 $('.adserver-close-button-float').on('click', function () { 54 $(this).closest('.revive-flotante.banner-adserver').fadeOut(); 55 }); 56 }); 57})(jQuery); 58 59/*Control scroll menú principal - home*/ 60(function ($, Drupal) { 61 Drupal.behaviors.fixedMenuFlotante = { 62 attach: function (context, settings) { 63 const $menus = $('#block-marca-pais-navegacionprincipaling-2, #block-menu-mobil-main', context); 64 65 if (!$menus.length) return; 66 67 let triggerOffsets = []; 68 69 function calculateOffset($menu) { 70 const isMobile = window.innerWidth <= 768; 71 const offsetAdjustment = isMobile ? 70 : 90; 72 return $menu.offset().top + offsetAdjustment; 73 } 74 75 $menus.each(function () { 76 const $menu = $(this); 77 triggerOffsets.push({ 78 element: $menu, 79 triggerOffset: calculateOffset($menu), 80 isFixed: false 81 }); 82 }); 83 84 function updateFixedMenus() { 85 const scrollTop = $(window).scrollTop(); 86 87 triggerOffsets.forEach(function (item) { 88 if (scrollTop >= item.triggerOffset && !item.isFixed) { 89 item.element.addClass("fixed-header").css({ 90 "position": "fixed", 91 "top": "0", 92 "left": "0", 93 "width": "100%", 94 "z-index": "999" 95 }); 96 item.isFixed = true; 97 } else if (scrollTop < item.triggerOffset && item.isFixed) { 98 item.element.removeClass("fixed-header").css({ 99 "position": "absolute", 100 "top": "", 101 "left": "", 102 "width": "", 103 "z-index": "" 104 }); 105 item.isFixed = false; 106 } 107 }); 108 } 109 $(window).on("resize", function () { 110 triggerOffsets.forEach(function (item) { 111 item.triggerOffset = calculateOffset(item.element); 112 }); 113 114 updateFixedMenus(); 115 }); 116 $(window).on("scroll", updateFixedMenus); 117 } 118 }; 119})(jQuery, Drupal); 120 121
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.