Pinned Loading
-
Same height of elements
Same height of elements 1export const sameHeight = (group: Element, elements: string | NodeListOf<HTMLElement>, byRow = false) => {
2const targets = elements instanceof NodeList ? Array.from(elements) : Array.from(group.querySelectorAll<HTMLElement>(elements))
34const getHighestElement = (elements: HTMLElement[] = targets): number => {
5const heights = elements.map((box) => box.clientHeight)
-
sizeChange.ts
sizeChange.ts 1const handle = () => {
2console.log("Yo my size changed, do something with me")
3}
45const resizeObserver = new ResizeObserver(handle)
-
clickOutsideHandle.ts
clickOutsideHandle.ts 1const myElementSelector = ".my-element"
23document.addEventListener("click", ({target}) => {
4if (target instanceof Element && !target?.closest(myElementSelector)) {
5console.log("click outside")
-
breakpointSwitch.ts
breakpointSwitch.ts 1const mobileQuery = window.matchMedia("(max-width: 74.999em)") // Change to your needs
23const handleMobileChange = (mediaQueryList: MediaQueryListEvent | MediaQueryList) => {
4if (mediaQueryList.matches) {
5// Its Mobile
-
navigation handle
navigation handle 1const mainNav = document.querySelector(".main-header__nav")
2const overlay = document.querySelector(".c-overlay")
34const closers = document.querySelectorAll(".--js-main-nav-closer")
5const openers = document.querySelectorAll(".--js-main-nav-opener")
-
Abstract tabs handle
Abstract tabs handle 1const tabsGroup = document.querySelectorAll(".js-tabs")
234tabsGroup.forEach(tabGroup => {
5const tabItems = tabGroup.querySelectorAll(".js-tabs__tab-item")
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.