实现代码如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | < title >模态窗口</ title > <!--[if (gte IE 9)|!(IE)]>>--> <!--<!--[if lte IE 8 ]>--> < button type = "button" class = "am-btn am-btn-primary" data-am-modal = "{target: '#doc-modal-1', closeViaDimmer: 0, width: 400, height: 225}" > Modal </ button > < div class = "am-modal am-modal-no-btn" id = "doc-modal-1" > < div class = "am-modal-dialog" > < div class = "am-modal-hd" >Modal 标题 < a href = "%20void(0)" class = "am-close am-close-spin" data-am-modal-close = "" >×</ a > </ div > < div class = "am-modal-bd" > Modal 内容。本 Modal 无法通过遮罩层关闭。 </ div > </ div > </ div > < button type = "button" class = "am-btn am-btn-primary" data-am-modal = "{target: '#my-alert'}" > Alert </ button > < div class = "am-modal am-modal-alert" id = "my-alert" > < div class = "am-modal-dialog" > < div class = "am-modal-hd" >Amaze UI</ div > < div class = "am-modal-bd" > Hello world! </ div > < div class = "am-modal-footer" > < span class = "am-modal-btn" >确定</ span > </ div > </ div > </ div > < button type = "button" class = "am-btn am-btn-warning" id = "doc-confirm-toggle" > Confirm </ button > |
$(function() {
$(‘#doc-modal-list’).find(‘.am-icon-close’).add(‘#doc-confirm-toggle’).
on(‘click’, function() {
$(‘#my-confirm’).modal({
relatedTarget: this,
onConfirm: function(options) {
var $link = $(this.relatedTarget).prev(‘a’);
var msg = $link.length ? ‘你要删除的链接 ID 为 ‘ + $link.data(‘id’) :
‘确定了,但不知道要整哪样’;
alert(msg);
},
// closeOnConfirm: false,
onCancel: function() {
alert(‘算求,不弄了’);
}
});
});
});
$(function() {
$(‘#doc-prompt-toggle’).on(‘click’, function() {
$(‘#my-prompt’).modal({
relatedTarget: this,
onConfirm: function(e) {
alert(‘你输入的是:’ + e.data || ”)
},
onCancel: function(e) {
alert(‘不想说!’);
}
});
});
});
…
×
效果图:
总结
到此这篇关于AmazeUI 模态窗口的实现代码的文章就介绍到这了,更多相关AmazeUI 模态窗口内容请搜索IT俱乐部以前的文章或继续浏览下面的相关文章,希望大家以后多多支持IT俱乐部!