简体   繁体   中英

Pre-Load Custom Cursors With Javascript

I have been able to successfully preload image gallery before page loads but was wondering how I could do the same for custom cursor.cur files as it doesn't work using the image method below as it cant understand .cur extension?

// Image Preloader
var pictures [
    "a.jpg",
    ..
    "z.jpg"
];

for (var i=0;i < pictures.length; i++){
    var img = new Image()
    img.src = pictures[i];
    img.onload = function(){
        updateProgress();
    }
}

Load the ico file using an AJAX .get() and ignore the response. The response should be cached in the browser. Something like:

    $.get('/favicon.ico', function() {
        alert('Loading of ICO file completed!');
        // Do other processing here
    });  

http://jsfiddle.net/BGG2m/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM