预装载图片的又一个办法

通常预装载图片是使用Javascript。DW提供的代码也是这么做的。
其实还可以用CSS来做,不需要额外的js代码。
例如:
#preloadImages{
    display:inline;
    width:0px;
    height:0px;
    background-image: url(path/to/image1.png);
    background-image: url(path/to/image2.png);
    background-image: url(path/to/image3.png);
    background-image: url();
}

3 thoughts on “预装载图片的又一个办法

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.