need some help figuring out a bug in my website, this is my first forum post about it.
So for the first time I lazy-loaded my CSS into my site below the fold. This works great except it breaks one JS plugin on mobile only, not sure why this is the case. In the portfolio section, all the images are squished very small - the CSS is not being applied and I am not sure why. Thanks for any help!
My site: http://www.fitz-maurice.com
Site's repo: https://github.com/c-fitzmaurice/Fitz
The plugin: http://isotope.metafizzy.co/
Below are the scripts loaded by the page, just before </body>
at the very bottom.
<script src="assets/js/jquery.js"></script>
<script src="assets/js/plugins.min.js"></script>
<script src="rs-plugin/js/jquery.themepunch.tools.min.js"></script>
<script src="rs-plugin/js/jquery.themepunch.revolution.min.js"></script>
<script src="assets/js/hisrc.min.js"></script>
<script src="assets/js/scripts.min.js"></script>
Then inside of scripts.min.js
the below is run.
/* ============== CSS LAZY LOAD ============== */
function loadCSS(href){
var ss = window.document.createElement('link');
var head = window.document.getElementsByTagName('head')[0];
ss.rel = 'stylesheet';
ss.href = href;
// temporarily, set media to something non-matching to ensure it'll fetch without blocking render
ss.media = 'only x';
head.appendChild(ss);
setTimeout( function(){
// set media back to `all` so that the stylesheet applies once it loads
ss.media = 'all';
},0);
}
/* ============== PAGE READY FUNCTION ============== */
$(document).ready(function () {
jQuery('#preloader').fadeOut(300);
loadCSS('assets/css/bootstrap.css');
loadCSS('rs-plugin/css/settings.css');
loadCSS('assets/css/main.css');
loadCSS('http://fonts.googleapis.com/css?family=Raleway:400,600,700,300');
setTimeout(hideFitz, 2000);
});