AloneJs.albumBox() —— 相簿對話方塊

來源:互聯網
上載者:User

標籤:

一、引用

<link href="http://alonejs.suziyun.com:8080/alonejs.min.css" rel="stylesheet" /><script src="https://code.jquery.com/jquery-3.1.0.min.js"></script><script src="http://alonejs.suziyun.com:8080/alonejs.min.js"></script>

 

二、調用樣本

AloneJs.albumBox = function (fnOK) {
iBox.show({
title: "選擇圖片",
width: 705,
height: 425,
modal: true,
content: function (e) {
var $el = e.$scope; //擷取對話方塊的jQuery對象
AloneJs($el).showLoader(); //顯示載入進度條
$.ajax({
url: ‘/product/album.html‘,
type: ‘GET‘,
data: {
m: false
},
success: function (data) {
if (data) {
$el.html(data); //將非同步請求的html內容顯示在對話方塊中
e.window.adjustPosition(); //重新調整對話方塊的位置
}
AloneJs($el).closeLoader(); //關閉進度條
}
});
},
buttons: [
{
text: "取消"
},
{
text: "確定",
focus: true,
fn: function (e) {
var $win = e.$scope,
images = []; //定義數組記錄選中的圖片地址
//擷取選中的圖片
$win.find(‘.sl-album-photolist .photo-item-mask‘).each(function () {
var image = $(this).parent().attr("data-image");
if (image && image.length > 0) {
images.push(image);
}
});
if (images.length > 0) {
//執行回呼函數,並將選中的圖片數組作為參數傳入回呼函數
if ($.type(fnOK) == "function") {
fnOK(images);
}
} else {
iBox.msgbox("請選擇一張圖片!", { autoClose: 1200, modal: true });
return false;
}
}
}
]
});
};

 

 其中,非同步請求“/product/album.html”頁面的內容即為內容:

 

AloneJs.albumBox() —— 相簿對話方塊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.