我的网站上有一个网页, 里面有100张图像,
有没有办法让它更优雅 和高兴的看到?
我的网站上有一个网页, 里面有100张图像,
有没有办法让它更优雅 和高兴的看到?
您可以 < a href=>" "http://www.appeselsiini.net/ projects/lazyload" rel="不跟随 noreferrer"\\ strong > Lazy load 图像, 这意味着它们只在浏览器上显示时才装入。 只需使用以下方法即可 :
$("img.lazy").lazyload();
但是,如果页面负载中可见的图像非常大的文件大小, 您无法做多少事情来阻止它 。
我之前用来使这个更方便用户的想法是,将每个 img
元素都放置在 div
中,该元素的背景图像为 < a href=" http://ajaxload.info/" rel= "nofollow noreferrer" > ajaax loader 。这至少让人看到某些东西正在装入。然后,一旦装入图像,这将覆盖装入图像 。
EDIT: < /strong> 见您的 < a href=> https://stackoverflow.com/ questions/10735366/ best-way-to-load-100-images- in-one-page/10735400#comment/13946542_10735366>>
http://spritegen.website-properation.org/" rel="notfollow noreferrer">CSS Splite 生成器 也可用于阻止你完成自己完成的艰巨任务:
由于图像非常小, 这可能是 cs 示意图有用的情况 。
您没有100+小图像, 而是有一个大的图像 。
想要显示特定图像时,必须指定背景坐标,例如:
div#div1 {background-position:0px -100px}
让图像在装入时淡化,
$( img ).css( opacity , 0.0 ).load(function(){
$(this).animate({ opacity : 1.0 });
});
http://jsfidle.net/ Guffa/gzFFN/" rel="nofollow" >http://jsfidle.net/ Guffa/gzFFN/
http://code.google.com/p/jquery-appear/" rel="no follow" >http://code.google.com/p/jquery-appear/
当对象“出现”即显示在屏幕上时, jQuery 出现事件就会触发 。
为所有图像创建容器, 仅在屏幕上可见时才装入实际图像 。
也可以在这个堆叠链接上找到另一个有趣的解决方案。 它适用于所有内容, 但答案中提供的代码也可以适用于图像装入 。 Link
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!