Adding Astrojs sources.

This commit is contained in:
Benjamin A. Shelton 2026-06-05 14:31:12 -06:00
commit e20f4f45de
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
169 changed files with 11389 additions and 0 deletions

View file

@ -0,0 +1,55 @@
import $$ from '@utilities/selectors'
import { exists } from '@utilities/helpers'
const Lazyload = function Lazyload()
{
// lazyload our images
const images = $$.wrapper.querySelectorAll('[data-src]')
if ( exists(images) )
{
// options
const options = {
threshold: 0.5
}
const preloadImage = (img) => {
// find and store the image's data-load attribute
const src = img.dataset.src
img.src = src
// add a class of loaded
// we can then use this as a hook for fade-in animations etc
img.classList.add('loaded')
img.removeAttribute('data-src')
}
const lazyLoad = new IntersectionObserver((entries, lazyLoad) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
preloadImage(entry.target)
lazyLoad.unobserve(entry.target)
}
})
}, options)
images.forEach(image => {
lazyLoad.observe(image)
})
}
}()
export default Lazyload

View file

@ -0,0 +1,27 @@
import $$ from '@utilities/selectors'
const MobileNav = function MobileNav()
{
$$.mobileNavToggle.addEventListener('click', function() {
this.classList.toggle('expanded')
$$.mobileNav.classList.toggle('menu-visible')
// set aria-expanded attribute on menu toggle button
if ( this.getAttribute('aria-expanded') === 'false' )
{
this.setAttribute('aria-expanded', 'true')
} else {
this.setAttribute('aria-expanded', 'false')
}
})
}()
export default MobileNav