亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

圖片預(yù)載入第1/3頁(yè)

 更新時(shí)間:2006年10月03日 00:00:00   作者:  
特點(diǎn):
1.圖片預(yù)載入,載入后再顯示。意圖一次呈現(xiàn),不會(huì)讓一塊一塊下載破壞你的頁(yè)面,絕佳的用戶體驗(yàn),顛覆傳統(tǒng)的瀏覽器呈現(xiàn)圖片的處理方式(需要后續(xù)函數(shù)支持)。
2.不會(huì)因載入圖片造成腳本暫停假死,完全另一線程進(jìn)行。不影響主程序流程。
3.提供及時(shí)的反饋,包括兩方面的內(nèi)容:1.正在載入什么圖片 2.當(dāng)前的百分?jǐn)?shù)進(jìn)度。大大提高留住用戶眼球的概率,不會(huì)讓用戶因?yàn)榭嗟榷x開(kāi)。
4.容錯(cuò)支持,即使某個(gè)圖片沒(méi)有成功下載,也可以設(shè)置超時(shí)時(shí)間以便處理下一個(gè)圖片。
5.多變的參數(shù)類型,盡最大可能方便使用。
復(fù)制代碼 代碼如下:

// save this as "image_loader.js"

//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//
/*
  ImageLoader, Version 1.1, JavaScript 
  (c) 2006 Christian An <anchangsi@gmail.com>

  With copyright not modified, you can use this program freely. 
*/
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//

function ImageLoader(className,Options){
    this._ImageLoadStack = null;
    this._currrentLoading = "";
    this._FinalRun = false;
    this.numLoaded = 0;
    this.ClassName = className;

    if(typeof(Options)=="undefined") Options = {};

    if(isNaN(Options.Timeout) || Options.Timeout < 0 ||  Options.Timeout >100000){
        this.EnableTimeout = false;
    }else {
        this.EnableTimeout = true;
        this.Timeout = Options.Timeout;
    }

    if(typeof(Options.func)=="undefined"){
        this.AfterFunction = null;
    }else{
        this.AfterFunction = Options.func;
    }

    if(typeof(Options.display)=="undefined"){
        this.disDiv = null;
    }else if(typeof(Options.display)=="string"){
        this.disDiv = document.getElementById(Options.display);
    }else if(typeof(Options.display)=="object"){
        this.disDiv = Options.display;
    }else{
        this.disDiv = null;
    }

    if(typeof(Options.process)=="undefined"){
        this.procDiv = null;
    }else if(typeof(Options.process)=="string"){
        this.procDiv = document.getElementById(Options.process);
    }else if(typeof(Options.process)=="object"){
        this.procDiv = Options.process;
    }else{
        this.procDiv = null;
    }

    
    if(typeof(document.imageArray)=="undefined") document.imageArray = new Array();

    this.Load = function(){
        var args = this.Load.arguments;
        if(args.length!=0){
            this._ImageLoadStack = new Array();
            for(i=0; i<args.length; i++){
                if(args[i].indexOf("#")!=0){
                    this._ImageLoadStack.push(args[i]);
                }
            }

        }else if(this._ImageLoadStack == null){
            this._runFinal();
        }
        this.numTotal = this._ImageLoadStack.length;
        this._LoadAImage();
    }

    this._LoadAImage = function(){
        if(this._ImageLoadStack.length!=0){
            var sURL = this._ImageLoadStack.shift();
            if(this.disDiv!=null) this.disDiv.innerHTML = sURL;
            _currrentLoading = sURL;

            
            var j = document.imageArray.length;
            document.imageArray[j] = document.createElement("IMG");
            document.imageArray[j].Owner = this;

            document.imageArray[j].onload = function(){
                this.Owner._LoadAImage();
                this.onload = null;
            }
            document.imageArray[j].onerror = function(){
                this.Owner._LoadAImage();
                this.onload = null;
            }

            if(this.EnableTimeout){
                window.setTimeout("if(_currrentLoading==\""+sURL+"\"){"+this.ClassName+"._LoadAImage()}",this.Timeout);
            }

            document.imageArray[j++].src = sURL;
                if(this.procDiv!=null){
                this.numLoaded++;
                var percentage = Math.floor(this.numLoaded * 100 / this.numTotal);
                this.procDiv.innerHTML = percentage;
            }

        }else{
            this._runFinal();
        }

    }
    this._runFinal = function(){
            if(this._FinalRun == false){
                this._FinalRun = true;

                if(typeof(this.AfterFunction)=="function"){
                    this.AfterFunction();
                }else if(typeof(this.AfterFunction)=="string"){
                    if (window.execScript){
                        window.execScript(this.AfterFunction);
                    }else{
                        window.eval(this.AfterFunction); 
                    }
                }
            }
    }
    this.setLoadImages = function(imageArray){
        if(typeof(imageArray)!="object") return;
        this._ImageLoadStack = imageArray;
    }

}

相關(guān)文章

  • JavaScript 使用 splice 方法刪除數(shù)組元素可能導(dǎo)致的問(wèn)題分析

    JavaScript 使用 splice 方法刪除數(shù)組元素可能導(dǎo)致的問(wèn)題分析

    這篇文章主要介紹了JavaScript 使用 splice 方法刪除數(shù)組元素可能導(dǎo)致的問(wèn)題分析,當(dāng)在 JavaScript 中從數(shù)組中刪除元素時(shí),使用 splice 方法時(shí)需要謹(jǐn)慎,本文給大家詳細(xì)講解,需要的朋友可以參考下
    2023-04-04
  • 使用JavaScript構(gòu)建JSON格式字符串實(shí)現(xiàn)步驟

    使用JavaScript構(gòu)建JSON格式字符串實(shí)現(xiàn)步驟

    這篇文章將幫助你使用javascript來(lái)創(chuàng)建json格式字符串如果你需要通過(guò)web項(xiàng)目來(lái)構(gòu)建json格式字符串的響應(yīng),感興趣的各位可以參考下哈,希望可以幫助到你
    2013-03-03
  • JavaScript 版本自動(dòng)生成文章摘要

    JavaScript 版本自動(dòng)生成文章摘要

    搜了搜這個(gè),發(fā)現(xiàn)找不到答案。所以自己寫(xiě)了一個(gè),很多程序繞過(guò)這個(gè)問(wèn)題,往往人工來(lái)決定在何處截?cái)?,太麻煩了。
    2008-07-07
  • javacript使用break內(nèi)層跳出外層循環(huán)分析

    javacript使用break內(nèi)層跳出外層循環(huán)分析

    這篇文章主要介紹了javacript使用break內(nèi)層跳出外層循環(huán)的用法,以實(shí)例形式對(duì)比分析了循環(huán)跳出break語(yǔ)句的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-01-01
  • js實(shí)現(xiàn)帶按鈕的上下滾動(dòng)效果

    js實(shí)現(xiàn)帶按鈕的上下滾動(dòng)效果

    這篇文章主要介紹了js實(shí)現(xiàn)帶按鈕的上下滾動(dòng)效果,設(shè)計(jì)javascript鼠標(biāo)事件及頁(yè)面元素樣式的相關(guān)操作技巧,需要的朋友可以參考下
    2015-05-05
  • 如何創(chuàng)建?JavaScript?自定義事件

    如何創(chuàng)建?JavaScript?自定義事件

    這篇文章主要介紹了如何創(chuàng)建?JavaScript?自定義事件,我們將通過(guò)文章學(xué)習(xí)到有關(guān)創(chuàng)建自定義事件,偵聽(tīng)自定義事件以及創(chuàng)建雙擊自定義事件所要了解的內(nèi)容,需要的朋友可以參考一下
    2022-05-05
  • JavaScript實(shí)現(xiàn)倒計(jì)時(shí)代碼段Item1(非常實(shí)用)

    JavaScript實(shí)現(xiàn)倒計(jì)時(shí)代碼段Item1(非常實(shí)用)

    現(xiàn)今團(tuán)購(gòu)網(wǎng)、電商網(wǎng)、門(mén)戶網(wǎng)等,常使用時(shí)間記錄重要的時(shí)刻,如時(shí)間顯示、倒計(jì)時(shí)差、限時(shí)搶購(gòu)等,本文分析不同倒計(jì)時(shí)效果的計(jì)算思路及方法,掌握日期對(duì)象Date,獲取時(shí)間的方法,計(jì)算時(shí)差的方法,實(shí)現(xiàn)不同的倒時(shí)計(jì)效果
    2015-11-11
  • 引用 js在IE與FF之間的區(qū)別詳細(xì)解析

    引用 js在IE與FF之間的區(qū)別詳細(xì)解析

    這篇文章主要介紹了js在IE與FF之間的區(qū)別。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2013-11-11
  • jquery實(shí)現(xiàn)select下拉框美化特效代碼分享

    jquery實(shí)現(xiàn)select下拉框美化特效代碼分享

    這篇文章主要介紹了jquery實(shí)現(xiàn)select下拉框美化特效,實(shí)現(xiàn)效果簡(jiǎn)潔大方,推薦給大家,有需要的小伙伴可以參考下。
    2015-08-08
  • Javascript 鍵盤(pán)keyCode鍵碼值表

    Javascript 鍵盤(pán)keyCode鍵碼值表

    Javascript 鍵盤(pán)keyCode鍵碼值表,需要的朋友可以保存一份。
    2009-12-12

最新評(píng)論