Ticket #56 (closed Bug: fixed)
产品库图片终端页网速优化
| Reported by: | yuanhuoqing | Owned by: | qinghonggang |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | 产品库 | Version: | 产品库3.0 |
| Keywords: | Cc: | ||
| Due Date: | 11/11/2011 |
Description (last modified by qinghonggang) (diff)
为了方便第三方能统计到产品库终端页面的访问数据,把原来分页不刷新页面改成刷新页面,这样增加了服务器响应的时间而导致网速变慢,用户体验不好导致pv下降20%左右。
为了提高网速和优化用户体验,根据网速组李强的建议采取的优化方法如下:
1、优化页面js的顺序;
2、增加图片加载过程的提示图,方便网友切换到下一张或上一张图片;
3、预加载当前图片以下的5张图片,提高图片的加载速度;
通过以上优化pv在原来基础上上升了10%左右。
Change History
comment:3 Changed 14 years ago by chenchongqi
- Status changed from new to closed
- Version changed from 1.0 to 4.0
- Resolution set to fixed
comment:4 Changed 14 years ago by qinghonggang
具体调整代码如下:
1、“产品基本信息”块以及“标签”块代码后置,部分关联的js提前。
2、提高视觉效果,增加图片加载提示图,相关代码:
<script>
function hideLoading(){
document.getElementById('pLoading').style.display='none';
}
</script>
<div class="ext-preloading" id="pLoading"></div>
3、将当前图片的后5张图片加载到浏览器内存中,相关js代码:
var nextPics= ["<%=next5Pic[0]%>","<%=next5Pic[1]%>","<%=next5Pic[2]%>"," <%=next5Pic[3]%>","<%=next5Pic[4]%>"];
function preLoadImg(imgs, index){
if(index >= imgs.length) return;
var img = new Image();
img.onload = function(){
preLoadImg(imgs, index+1);
};
img.src = imgs[index];
}
window.onload = function(){
setTimeout(function(){
preLoadImg(nextPics,0)
}, 200);
};
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/hr/2009/global/images/logo.gif)