UNPKG

alrdy-animate

Version:

A library to handle animations on scroll with GSAP integration.

1 lines 1.59 kB
"use strict";(this.webpackChunkAlrdyAnimate=this.webpackChunkAlrdyAnimate||[]).push([[341],{971:(e,t,a)=>{function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=document.querySelector("[aa-modal-group]"),a=document.querySelectorAll("[aa-modal-target]"),n=document.querySelectorAll("[aa-modal-close]"),o=null;function l(){t&&(t.setAttribute("aa-modal-group-status","not-active"),t.querySelectorAll("[aa-modal-name]").forEach((function(e){e.setAttribute("aa-modal-status","not-active")})),e?e.start():document.body.style.overflow="",o=null,document.removeEventListener("keydown",r),document.removeEventListener("keydown",c))}function r(e){if(o){var t=o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(t.length){var a=t[0],n=t[t.length-1];"Tab"===e.key&&(e.shiftKey&&document.activeElement===a?(e.preventDefault(),n.focus()):e.shiftKey||document.activeElement!==n||(e.preventDefault(),a.focus()))}}}function c(e){"Escape"===e.key&&l()}return a.forEach((function(a){a.addEventListener("click",(function(){var n=a.getAttribute("aa-modal-target");if(t){l();var u=t.querySelector('[aa-modal-name="'.concat(n,'"]'));u&&(t.setAttribute("aa-modal-group-status","active"),u.setAttribute("aa-modal-status","active"),e?e.stop():document.body.style.overflow="hidden",o=u,document.addEventListener("keydown",r),document.addEventListener("keydown",c))}}))})),n.forEach((function(e){e.addEventListener("click",l)})),t&&t.addEventListener("click",(function(e){e.target===t&&l()})),{closeAll:l}}a.r(t),a.d(t,{initializeModals:()=>n})}}]);