$(document).ready(function () { //nav mobile $(".submenu-btn").on("change", function () { console.log("change"); $(".submenu-btn").prop("checked", false); $(this).prop("checked", true); }); // $(document).on($.modal.BEFORE_OPEN, function(e, modal) { // $('html, body').animate({ // scrollTop: 0 // Use element id to get element's location. // }, 500); // }) document.querySelector("body").scrollIntoView(); $(document).on($.modal.OPEN, function (e, modal) { $("body").scrollTop(0); document.querySelector("body").scrollIntoView(); }); // FUNCION PARA ACORTAR TEXTOS // const $paragraphs = document.querySelectorAll("p.description"); // $paragraphs.forEach(($p) => { // // Looking texts // let text = $p.textContent.trim(); // // "sup" tags // const supTag = (char) => // `${char}`; // const supChars = ["®", "™"]; // const supRegex = new RegExp(supChars.join("|"), "g"); // // Pulling away text by spaces // const arrayText = text.split(" "); // // Max length word and char // const maxWord = 20; // const maxChar = 150; // // We cut the text // if (arrayText.length > maxWord) { // text = arrayText.slice(0, maxWord).join(" ") + "..."; // } // if (text.length > maxChar) { // text = text.slice(0, maxChar).trim() + "..."; // } // // We need to add HTML tags to some characters // const textsFormated = text.split(" ").map((word) => { // let newWord = word; // supChars.forEach((sup) => { // if (word.includes(sup)) newWord = word.replace(supRegex, supTag(sup)); // }); // return newWord; // }); // // Add modified text into the DOM // $p.innerHTML = textsFormated.join(" "); // }); });