我有一个从远程数据库获取内容的Widget。加载速度通常比页面慢。最初,在加载时,它的轮廓比最终的轮廓要小。由于与页面呈现有关的许多原因,它会导致问题。
小部件加载一些相册艺术。有没有一种方法可以加载占位符jpeg,这样小部件在视觉上具有连续性,但当真正的内容到达时,页面加载时不会改变大小和布局?
我不能100%确定我可以在这里发布什么作为例子或尝试。但如果需要的话,我可以使用当前的Wordpress插件。
这里的示例-在加载页面时上下滚动,并在左侧边栏中查看相册艺术加载。
我的尝试。。。
/* IMAGE PLACEHOLDER */
#samsonginfo_widget_li_djart::-webkit-input-placeholder {
color: transparent;
text-indent: -9999px;
background-image: url("http://placehold.it/150x150");
background-position: 0 50%;
background-repeat: no-repeat;
}
#samsonginfo_widget_li_djart::-moz-placeholder {
/* Firefox 19+ */
color: transparent;
text-indent: -9999px;
background-image: url("http://placehold.it/150x150");
background-position: 0 50%;
background-repeat: no-repeat;
}
#samsonginfo_widget_li_djart:-moz-placeholder {
/* Firefox 18- */
color: transparent;
text-indent: -9999px;
background-image: url("http://placehold.it/150x150");
background-position: 0 50%;
background-repeat: no-repeat;
}
#samsonginfo_widget_li_djart:-ms-input-placeholder {
/* IE 10- */
color: transparent;
text-indent: -9999px;
background-image: url("http://placehold.it/150x150");
background-position: 0 50%;
background-repeat: no-repeat;
好的,答案是:
.samsonginfo_widget {
min-height:265px;
background-image: url("http://placehold.it/150x150");
background-position: left bottom;
background-repeat: no-repeat;
}
.samsonginfo_widget ul {
background:#fff;
}