Skip to content

Commit

Permalink
re enabled custom code load src
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshvdw committed Dec 6, 2024
1 parent db3495d commit 78af1be
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions js/global/projectLotties.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ export default function initProjectLotties() {
// check if lottie players exist
if (document.querySelectorAll('lottie-player').length > 0) {
// create array with all lotie players
// var allLotties = [...document.querySelectorAll('lottie-player')]
// //var allLottiesHover = document.querySelectorAll('.hover-lottie-wrapper')
var allLotties = [...document.querySelectorAll('lottie-player')]
//var allLottiesHover = document.querySelectorAll('.hover-lottie-wrapper')

// let isMobile = window.innerWidth < 428
let isMobile = window.innerWidth < 428

// // create new array from lotties if it doesn't have a source attribute
// allLotties = allLotties.filter( l => !l.hasAttribute('src'))
// create new array from lotties if it doesn't have a source attribute
allLotties = allLotties.filter( l => !l.hasAttribute('src'))

// allLotties.forEach( e => {
// // get source based to mobile or desktop based on mobile / screen width
// let source = isMobile ? e.getAttribute('mobile-source') : e.getAttribute('desktop-source')
// // if source is not empty, load the source into each lottie player
// if(source != ''){
// e.load(source)
// }
// })
allLotties.forEach( e => {
// get source based to mobile or desktop based on mobile / screen width
let source = isMobile ? e.getAttribute('mobile-source') : e.getAttribute('desktop-source')
// if source is not empty, load the source into each lottie player
if(source != ''){
e.load(source)
}
})

// remove safari placeholder
document.querySelectorAll('.safari-image').forEach(e => {
Expand Down

0 comments on commit 78af1be

Please sign in to comment.