PageSourceSearch

https://www.uandes.cl/wp-content/themes/uandes-main/js/sliders.js?ver=2.36.15

js uandes.cl collected 2026-10-01 10:40:46 UTC 10,382 bytes, 343 lines download raw bytes

1(function ($) {
2  $(document).ready(function () {
3    $(".show-drop").on("click", function () {
4      var $showContent = $(this).next(".show_content");
5      $showContent.toggleClass("hide");
6      $(this).toggleClass("active");
7    });
8
9    function openModal($modal) {
10      $modal.fadeIn(); // Muestra el modal
11    }
12
13    // Abrir modal al hacer clic en .video
14    $(".video").on("click", function () {
15      var $modal = $(this).next(".modal-video");
16      openModal($modal);
17    });
18
19    // Cerrar modal al hacer clic en la "X"
20    $(".modal-video .close-modal").on("click", function () {
21      $(this).closest(".modal-video").fadeOut(); // Oculta el modal
22    });
23
24    // Cerrar modal al hacer clic fuera del contenido del modal
25    $(document).on("click", function (e) {
26      if ($(e.target).hasClass("modal-video")) {
27        $(e.target).fadeOut(); // Oculta el modal
28      }
29    });
30
31    function initializeSliders() {
32      if ($(".slider-container").length) {
33        $(".slider-container").slick({
34          infinite: true,
35          autoplay: true,
36          dots: true,
37          arrows: true,
38          speed: 800,
39          autoplaySpeed: 5000,
40        });
41      }
42      if ($(".fp-more-uandes-listing").length) {
43        $(".fp-more-uandes-listing").slick({
44          slidesToShow: 5,
45          arrows: true,
46          infinite: false,
47          responsive: [
48            {
49              breakpoint: 800,
50              settings: {
51                slidesToShow: 1,
52                dots: true,
53                arrows: false,
54              },
55            },
56          ],
57        });
58      }
59      if ($(".cards-three-grid").length) {
60        $(".cards-three-grid").slick({
61          slidesToShow: 3,
62          arrows: false,
63          infinite: false,
64          responsive: [
65            {
66              breakpoint: 800,
67              settings: {
68                slidesToShow: 1,
69                dots: true,
70                arrows: false,
71              },
72            },
73          ],
74        });
75      }
76      if ($(".fp-social-listing").length) {
77        $(".fp-social-listing").slick({
78          slidesToShow: 5,
79          arrows: false,
80          infinite: false,
81          responsive: [
82            {
83              breakpoint: 800,
84              settings: {
85                slidesToShow: 1,
86                dots: true,
87                arrows: false,
88              },
89            },
90          ],
91        });
92      }
93
94      if ($(".blog-slider-authors").length) {
95        $(".blog-slider-authors").slick({
96          slidesToShow: 1,
97          arrows: false,
98          dots: true,
99          infinite: true,
100          autoplay: true,
101          autoplaySpeed: 6000,
102          speed: 600,
103          adaptiveHeight: true,
104        });
105      }
106
107      $(".hero-facultades").slick({
108        slidesToShow: 1,
109        autoplay: true,
110        autoplaySpeed: 5000,
111        arrows: true,
112        infinite: true,
113        dots: true,
114      });
115
116      $(".slider-video").slick({
117        slidesToShow: 1,
118        arrows: true,
119        infinite: false,
120        dots: true,
121      });
122
123      $(".novedades").slick({
124        slidesToShow: 4,
125        arrows: false,
126        dots: false,
127        infinite: false,
128        responsive: [
129          {
130            breakpoint: 800,
131            settings: {
132              slidesToShow: 1,
133              dots: true,
134              arrows: false,
135            },
136          },
137        ],
138      });
139
140      if (window.innerWidth <= 800) {
141        $(".fp-news-listing").slick({
142          responsive: [
143            {
144              breakpoint: 800,
145              settings: {
146                slidesToShow: 1,
147                dots: true,
148                arrows: false,
149                infinite: false,
150              },
151            },
152          ],
153        });
154        if (
155          !$(".events-listing").hasClass("slick-initialized") &&
156          !$(".events-listing").hasClass("no-slick")
157        ) {
158          $(".events-listing:not(.no-slick)").slick({
159            responsive: [
160              {
161                breakpoint: 800,
162                settings: {
163                  slidesToShow: 1,
164                  dots: true,
165                  arrows: false,
166                  infinite: false,
167                },
168              },
169            ],
170          });
171        }
172      }
173      // if ($('.slider-listing').length) {
174      //
175      //   $('.slider-listing').slick({
176      //     slidesToShow: 5,
177      //     arrows: false,
178      //     infinite: false,
179      //     responsive: [
180      //       {
181      //         breakpoint: 800,
182      //         settings: {
183      //           slidesToShow: 1,
184      //           dots: true,
185      //           arrows: false,
186      //         },
187      //       },
188      //     ],
189      //   });
190      // }
191    }
192
193    // si se requiere poner video descomentar esta linea
194    // $('.slider-container').slick("slickPause");
195
196    // $('.slider-container .slick-dots').addClass('d-m-h-none');
197    // $('.slider-container .slick-arrow').addClass('d-m-h-none');
198    // $('.mute').on('click', function () {
199    //   $('.mute').toggleClass('d-none');
200    //   $('.unMute').toggleClass('d-none');
201    // });
202
203    // $('.unMute').on('click', function () {
204    //   $('.mute').toggleClass('d-none');
205    //   $('.unMute').toggleClass('d-none');
206    // });
207
208    // $('.close-video').on('click', function () {
209    //   $('.slider-container').slick('slickGoTo', 1);
210    //   $('.slider-container').slick('slickRemove', 0);
211    // });
212
213    // Inicializar sliders primero para que el layout quede estable
214    initializeSliders();
215
216    // Verificar si hay un anchor link en la URL (ya con el layout final de los sliders)
217    var hash = window.location.hash; // Obtiene el anchor link (ej: #soy-titulo)
218    if (hash) {
219      // Pequeño timeout para absorber cualquier render asíncrono residual
220      setTimeout(function () {
221        var $targetCard = $(hash); // Selecciona la tarjeta con el ID correspondiente
222        if ($targetCard.length) {
223          // Desplazarse hasta la tarjeta (con offset del header fijo)
224          var headerEl = document.querySelector('header.main-menu');
225          var headerH = headerEl ? headerEl.offsetHeight : 0;
226          $("html, body").animate(
227            {
228              scrollTop: $targetCard.offset().top - headerH - 20,
229            },
230            800
231          ); // Duración de la animación en milisegundos
232
233          // Abrir el modal de la tarjeta
234          var $modal = $targetCard.find(".modal-video");
235          openModal($modal);
236        }
237      }, 150);
238    }
239  });
240  jQuery(window).on("resize", function () {});
241
242  // Obtener todos los elementos <li>
243  const lis = document.querySelectorAll(".main-menu .menu-function-mobile li");
244  const uls = document.querySelectorAll(".main-menu .menu-function-mobile ul");
245
246  // Obtener el botón "Ver Todos"
247  const verTodosBtn = document.getElementById("volver");
248
249  // Agregar un controlador de eventos para cada elemento <li>
250  lis.forEach((li) => {
251    li.addEventListener("click", () => {
252      // Agregar la clase "desplegado" al elemento clickeado
253      if (
254        li.querySelector(".clickeable") &&
255        !li.classList.contains("desplegado")
256      ) {
257        li.classList.add("desplegado");
258        document.getElementById("volver").classList.remove("d-none");
259      }
260
261      // Si el elemento <li> es "desplegable", mostrar sus hijos y ocultar los demás
262      if (li.classList.contains("desplegable")) {
263        // Ocultar los elementos <li> principales, pero no los secundarios
264        lis.forEach((l) => {
265          if (l !== li && !li.contains(l) && l.parentNode.parentNode !== li) {
266            l.style.display = "none";
267          } else {
268            l.style.display = "block";
269          }
270        });
271      }
272    });
273  });
274
275  uls.forEach((ul, i) => {
276    ul.addEventListener("click", () => {
277      // Agregar la clase "desplegado" al elemento clickeado
278      if (
279        ul.querySelector(".clickeable") &&
280        !ul.classList.contains("desplegado")
281      ) {
282        ul.classList.add("desplegado");
283
284        // Ocultar el primer hijo del <li> padre que contenga un <a>
285        const liPadre = ul.parentNode;
286        const primerHijo = liPadre.querySelector("a");
287        if (primerHijo) {
288          primerHijo.style.display = "none";
289        }
290      }
291
292      // Si el elemento <ul> es "desplegable", mostrar sus hijos y ocultar los demás
293      if (ul.classList.contains("desplegado")) {
294        // Ocultar los elementos <ul> principales, pero no los secundarios
295        uls.forEach((l, j) => {
296          if (l == ul) {
297            // Recorrer los <ul> anteriores y agregar display none a sus primeros hijos <a>
298            for (let k = 0; k < i; k++) {
299              let ulAnterior = uls[k];
300              let primerHijo = ulAnterior.querySelector("a");
301              if (primerHijo) {
302                primerHijo.style.display = "none";
303              }
304            }
305          }
306          if (l !== ul && !ul.contains(l) && l.parentNode.parentNode !== ul) {
307            l.style.display = "none";
308          } else if (l == ul) {
309            l.style.display = "block";
310          }
311        });
312      }
313    });
314  });
315
316  // Agregar un controlador de eventos para el botón "Ver Todos"
317  verTodosBtn.addEventListener("click", () => {
318    // Mostrar todos los elementos <li> y <ul>
319    const elementosDesplegados = document.querySelectorAll(".desplegado");
320    const ultimoDesplegado =
321      elementosDesplegados[elementosDesplegados.length - 1];
322    const padreDelUltimo = ultimoDesplegado.parentElement;
323    ultimoDesplegado.classList.remove("desplegado");
324    if (padreDelUltimo.classList.contains("desplegado")) {
325      padreDelUltimo.classList.remove("desplegado");
326      const padreDelPadre = padreDelUltimo.parentElement;
327      const primerHijo = padreDelPadre.querySelector("a");
328      primerHijo.style.display = "block";
329      const mostrar = padreDelPadre.querySelectorAll("ul");
330      const nuevoArray = [...mostrar];
331      nuevoArray.forEach((ul) => {
332        ul.style.display = "block";
333        ul.querySelector("a").style.display = "block";
334      });
335    } else {
336      document.getElementById("volver").classList.add("d-none");
337      const primerMenu = document.querySelectorAll(".menu-function-mobile li");
338      primerMenu.forEach((li) => {
339        li.style.display = "block";
340      });
341    }
342  });
343})(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.