當前位置:首頁 » 文件管理 » jquery上傳多張圖片

jquery上傳多張圖片

發布時間: 2025-07-08 04:26:44

1. jquery 點擊一次載入幾張圖片,再點擊再載入幾張圖片,一直到所有圖片都顯示,怎麼實現

varimgMana=function(){
//內部指針索引
this.idx=0;
//需要載入的圖片列表
this.imgs=[
'https://dimg04.c-ctrip.com/images/70010b0000005a2k71535_280_170_112.jpg',
'https://dimg04.c-ctrip.com/images/700f0c0000006nxnfD731_280_170_112.jpg',
'https://dimg04.c-ctrip.com/images/70020h0000008s9xx8ACF_280_170_112.jpg',
'https://dimg04.c-ctrip.com/images/700j0h0000008sx877A9B_280_170_112.jpg',
'https://dimg04.c-ctrip.com/images/700u0h0000008zdvbA836_1920_360_111.jpg'
];
//載入圖片num:載入的數量
this.loadImg=function(num){
num=num||1;
varinfo,len=this.idx+num;
for(this.idx;this.idx<len;this.idx++){
info=this.imgs[this.idx];
if(!info){
alert('圖片都載入完啦');
returnthis;
}
this.render(info);
}
}
//渲染圖片
this.render=function(img){
img&&$('body').append("<imgsrc='"+img+"'/>");
}
returnthis;
}

//使用方式
varimgM=newimgMana();
$('.button').click(function(){
imgM.loadImg(2);
});

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:593
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:887
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:580
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:765
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:683
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1012
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:254
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:112
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:804
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:712