当图像加载时,我现在正在通过我的模板加载所有图像
//For example, I will just pass the image url into the tempate when the page renders
%div{class: "img_container <%= answer.image_scale %> <%=answer.show_image%>"}
<% if (media_con.standard_resolution) { %>
%a.fancy{href: "<%= media_con.standard_resolution %>"}
%img{src: "<%=media_con.standard_resolution%>"}
我意识到通过这样做(特别是如果我在页面上加载许多图像),它会导致效率低下,特别是在移动网络上很明显。
我如何才能仅在视图中加载图像(滚动),也许只是加载缩略图并在带有图像的视图出现时加载实际图像。
任何建议在这里表示赞赏