进度栏问题(使用onloadstart,onloadend,onloadprogress) [英] Progress Bar Issue (using onloadstart, onloadend, onloadprogress)
本文介绍了进度栏问题(使用onloadstart,onloadend,onloadprogress)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HTML代码:
<img class="boxImg" src="IMAGE_URL" onloadstart="showProgressBar('#loadBar')" onloadend="hideProgressBar('#loadBar')" />
<div id="loadBar">Loading</div>
JavaScript代码:
Javascript code:
function showProgressBar(div) { console.log("Load begin"); $(div).fadeIn(50);}
function hideProgressBar(div) { console.log("Load end"); $(div).fadeOut(50);}
图像加载正常,但未调用Javascript函数(控制台中无显示,并且div无效).
The image loads fine but the Javascript functions are not called (nothing appears in the console and the div does not have an effect).
推荐答案
onloadstart和onloadend仅支持音频和视频标签- http://www.w3schools.com/tags/av_event_loadstart.asp
onloadstart and onloadend supported only audio and video tags - http://www.w3schools.com/tags/av_event_loadstart.asp
这篇关于进度栏问题(使用onloadstart,onloadend,onloadprogress)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文