简体   繁体   English

使用 Javascript 预加载自定义游标

[英]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?我已经能够在页面加载之前成功预加载图片库,但想知道如何对自定义 cursor.cur 文件执行相同的操作,因为它无法使用下面的图像方法工作,因为它无法理解 .cur 扩展名?

// 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.使用 AJAX .get()加载 ico 文件并忽略响应。 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/ http://jsfiddle.net/BGG2m/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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