Google PageSpeed Insights Prioritize visible content

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 13:57:54

Embed all the contents of path.js directly in your HTML document.

Read here about Prioritizing Visible Content

you scripts might be used to render contents

The reason for this error was because of jQuery each function. I rebuilt the same thing, but only using a JavaScript for loop (no jQuery) and the error went away.

var arr = document.querySelectorAll("[data-min-height]");
for (var i = 0; i < arr.length; i++){
    var currentWindowHeight = window.innerHeight;
    var dataHeight = arr[i].dataset.minHeight;
    var dataPercent = dataHeight / 100;
    var dataPercentHeight = currentWindowHeight * dataPercent;
    arr[i].style.minHeight=dataPercentHeight + "px";
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!