| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
cm54
10年前发布

使用jQuery预加载图片

帮助在网页上快速加载图片,使它很容易保存和查看。

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…');  });