Preload Images On Your Website With JavaScript

This code will prevent your site form taking more time to load. This kind of situation looks bad but is also unprofessional. All you have to do is add your images to the preloadImages section and you are ready to roll.

<script type="text/javascript">

    var images = new Array();

    function preloadImages(){

        for (i=0; i < preloadImages.arguments.length; i++){

            images[i] = new Image();

            images[i].src = preloadImages.arguments[i];



    preloadImages("logo.jpg", "main_bg.jpg", 
        "body_bg.jpg", "header_bg.jpg");


No comments:

Post a Comment


php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Popular Posts