Last active
August 29, 2015 14:01
-
-
Save flexbox/c244d7bebd646582fcfe to your computer and use it in GitHub Desktop.
[blog] - small snippet for http://davidl.fr/blog/site-web-obese.html
This file contains hidden or 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
<html> | |
... | |
<script id="js-module-lazy"> | |
/* | |
JavaScript commented code | |
*/ | |
</script> | |
<script> | |
function lazyLoad(){ | |
var lazyElement = document.getElementById('js-module-lazy'); | |
var lazyElementContent = lazyElement.innerHTML; | |
var jsCode = stripOutCommentBlock(lazyElementContent); | |
eval(jsCode); | |
} | |
</script> | |
<button onclick="lazyLoad()">Lazy load feature</button> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment