我需要在从服务器加载图像之前启动微调器。
我的 HTML 页面包含
<img src="/imge/abc1.jpg" />
</br>
<p>This tesst text</p>
<img src="/imge/anyname.jpg" />
</br>
<p>This tesst text</p>
<img src="/imge/any.jpg" />
</br>
<p>This tesst text</p>
<img src="/imge/allname.jpg" />
</br>
<p>This tesst text</p>
我希望它在加载图像时显示微调器,例如 Facebook。
所以我需要替换 <img>
到旋转图像,直到加载真实图像
最佳答案
如果你想在 CSS
之前完成只需在您的 <head>
上编写代码标签
<style type="text/css">
img {
min-width:50px; /* if load.gif have 50px width */
min-height:50px; /* if load.gif have 50px height */
background: url('load.gif') no-repeat;
}
</style>
关于javascript - 如何在从服务器加载图像时设置预加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26425109/