返回顶部

收藏

使用jQuery预加载图片

更多

帮助在网页上快速加载图片,使它很容易保存和查看。javascript jQuery.preloadImagesInWebPage = function() { for(var ctr = 0; ctr<arguments.length; ctr++) { jQuery("").attr("src", arguments[ctr]); } } To use the above method, you can use the following piece of code: $.preloadImages("image1.gif", "image2.gif", "image3.gif"); To check whether an image has been loaded, you can use the following piece of code: $('#imageObject').attr('src', 'image1.gif').load(function() { alert('The image has been loaded…'); });

标签:javascript

收藏

0人收藏

支持

0

反对

0

发表评论