Remove last vestiges of Eleventy.
This commit is contained in:
parent
7da90092ad
commit
3ba519cf17
5 changed files with 0 additions and 155 deletions
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
// Import local modules
|
|
||||||
import '@modules/mobile-nav'
|
|
||||||
import '@modules/lazyload'
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
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
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
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
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
import $$ from '@utilities/selectors'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Test if the body id is something
|
|
||||||
* @param {string}
|
|
||||||
* @return {bool}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const page = function(name) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
return $$.body.getAttribute('id')
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($$.body.getAttribute('id') == name)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Check if element exists the page
|
|
||||||
* @param {string} Element selector
|
|
||||||
* @param {string} Minimum number of elements
|
|
||||||
* @return {bool}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const exists = function(el, limit) {
|
|
||||||
|
|
||||||
return (el.length > 0)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
page,
|
|
||||||
exists
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
|
|
||||||
const $$ = {
|
|
||||||
|
|
||||||
body : document.querySelector('body'),
|
|
||||||
|
|
||||||
wrapper : document.getElementById('wrapper'),
|
|
||||||
|
|
||||||
header : document.getElementById('header'),
|
|
||||||
|
|
||||||
nav : document.getElementById('nav'),
|
|
||||||
|
|
||||||
hero : document.getElementById('hero'),
|
|
||||||
|
|
||||||
main : document.getElementById('main'),
|
|
||||||
|
|
||||||
containerCentre : document.getElementById('container-centre'),
|
|
||||||
|
|
||||||
containerRight : document.getElementById('container-right'),
|
|
||||||
|
|
||||||
preFooter : document.getElementById('pre-footer'),
|
|
||||||
|
|
||||||
footer : document.getElementById('footer'),
|
|
||||||
|
|
||||||
mobileNav : document.getElementById('mobile-nav'),
|
|
||||||
|
|
||||||
mobileNavToggle : document.getElementById('mobile-nav-toggle')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default $$
|
|
||||||
Loading…
Reference in a new issue