Created
September 21, 2016 09:05
-
-
Save endymion1818/2404d57d890f8a08bcda419ca00a125e to your computer and use it in GitHub Desktop.
If the devide cuts the mustard, add some custard! Write from CDN, or local if that fails (after 1s)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// Mustard Cutting | |
if ('querySelector' in document && 'addEventListener' in window) { | |
var windowWidth = document.body.clientWidth; | |
if(windowWidth > 768){ | |
// add class to HTML tag | |
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement); | |
// load scripts - from cdn but with a fallback | |
document.write(unescape("%3Cscript src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js' type='text/javascript'%3E%3C/script%3E")); | |
document.write(unescape("%3Cscript src='https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.5/ScrollMagic.min.js' type='text/javascript'%3E%3C/script%3E")); | |
setTimeout(function() { | |
if (typeof TweenMax == 'undefined') { | |
document.write(unescape("%3Cscript src='../assets/js/gsap-tweenmax.min.js' type='text/javascript'%3E%3C/script%3E")); | |
} | |
if (typeof ScrollMagic == 'undefined') { | |
document.write(unescape("%3Cscript src='../assets/js/scrollmagic.min.js' type='text/javascript'%3E%3C/script%3E")); | |
} | |
}, | |
// timeout delay | |
1000 | |
); | |
</script> | |
<script type="text/javascript"> | |
// local scripts | |
document.write(unescape("%3Cscript src='../assets/js/ech-noncritical.min.js' type='text/javascript' defer%3E%3C/script%3E")); | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment