亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我是那出問題了?為什么有序加載只能加載第一個

我是那出問題了?為什么有序加載只能加載第一個

qq_nn_19 2017-10-26 17:52:29
function ?preLoad(imgs,options) { ? ?//接收相關數據之后實現加載 ? ?this.imgs = (typeof imgs === 'string') ? [imgs] : imgs; ? ?this.opts = $.extend({},preLoad.default,options); ? ?if(this.order === 'ordered'){ ? ? ? ?this._ordered(); ? ?} ? ?else ?if(this.order === 'unordered'){ ? ? ? ?this._unordered(); ? ?}}preLoad.default = {//默認參數 ? ?order:'unordered', ? ?each:null,//每一張圖片加載完畢后執行 ? ?all:null//所有圖片加載完畢后執行}preLoad.prototype._ordered = function() { ? ?var opts = this.opts, ? ? ? ?imgs = this.imgs, ? ? ? ?len = imgs.length, ? ? ? ?count = 0; ? ?load(); ? ?function load() { ? ? ? ?var imgObj = new Image(); ? ? ? ?$(imgObj).on('load error', function(e) { ? ? ? ? ? ?opts.each && opts.each(count); ? ? ? ? ? ?if ( count >= len) ? ? ? ? ? ?{opts.all && opts.all();} ? ? ? ? ? ?//所有圖片已經加載完畢 ? ? ? ? ? ? else ? ? ? ? ? ?load(); ? ? ? ? ? ?count++; ? ? ? ?}); ? ? ? ?imgObj.src = src; ? ?}}
查看完整描述

1 回答

已采納
?
牛奶老哥哥

TA貢獻204條經驗 獲得超92個贊

哪個課程的啊

查看完整回答
反對 回復 2017-10-26
  • qq_nn_19
    qq_nn_19
    就是jQUery圖片預加載課程的,不知道為什么那天在那節課那不能提問,我就在這問問
  • 1 回答
  • 0 關注
  • 1233 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號