这篇文章主要介绍了AmazeUI 模态窗口的实现代码,代码简单易懂,非常不错,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
实现代码如下所示:<!doctype html><html >
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>模态窗口</title>
<link rel="stylesheet" href="assets/css/amazeui.min.css">
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="assets/ie8/jquery.min.js"></script>
<script src="assets/ie8/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="assets/js/amazeui.min.js"></script>
</head>
<body style="margin: 50px;">
<!--基本形式-->
<button
type="button"
data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 400, height: 225}">
Modal
</button>
<ptabindex="-1" >
<p >
<p >Modal 标题
<a href="javascript: void(0)"data-am-modal-close>×</a>
</p>
<p >
Modal 内容。本 Modal 无法通过遮罩层关闭。
</p>
</p>
</p>
<!--模拟 Alert-->
<button
type="button"
data-am-modal="{target: '#my-alert'}">
Alert
</button>
<ptabindex="-1" >
<p >
<p >Amaze UI</p>
<p >
Hello world!
</p>
<p >
<span >确定</span>
</p>
</p>
</p>
<!--模拟 Confirm-->
<button
type="button"
>
Confirm
</button>
<ul>
<li><a data- href="#">每个人都有一道伤口, 或深或浅,盖上布,以为不存在。</a><i ></i></li>
</ul>
<ptabindex="-1" >
<p >
<p >Amaze UI</p>
<p >
你,确定要删除这条记录吗?
</p>
<p >
<spandata-am-modal-cancel>取消</span>
<spandata-am-modal-confirm>确定</span>
</p>
</p>
</p>
<script>
$(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('算求,不弄了');
}
});
});
});
</script>
<!--模拟 Prompt-->
<button
type="button"
>
Prompt
</button>
<ptabindex="-1" >
<p >
<p >Amaze UI</p>
<p >
来来来,吐槽点啥吧
<input type="text" >
</p>
<p >
<spandata-am-modal-cancel>取消</span>
<spandata-am-modal-confirm>提交</span>
</p>
</p>
</p>
<script>
$(function() {
$('#doc-prompt-toggle').on('click', function() {
$('#my-prompt').modal({
relatedTarget: this,
onConfirm: function(e) {
alert('你输入的是:' + e.data || '')
},
onCancel: function(e) {
alert('不想说!');
}
});
});
});
</script>
<!--Modal Loading-->
<button
type="button"
data-am-modal="{target: '#my-modal-loading'}">
Modal Loading
</button>
<ptabindex="-1" >
<p >
<p >正在载入...</p>
<p >
<span ></span>
</p>
</p>
</p>
<!--Actions-->
<button
type="button"
data-am-modal="{target: '#my-actions'}">
Actions
</button>
<p>
<p >
<ul >
<li >提示信息</li>
<li><a href="#"><span ></span>微信</a></li>
<li >
<a href="#"><i ></i>twitter</a>
</li>
</ul>
</p>
<p >
<buttondata-am-modal-close>取消</button>
</p>
</p>
<!--Popup-->
<button
type="button"
data-am-modal="{target: '#my-popup'}">
Popup
</button>
<p>
<p >
<p >
<h4 >...</h4>
<span data-am-modal-close
>×</span>
</p>
<p >
...
</p>
</p>
</p>
</body>
</html>效果图:总结来源:本站链接:https://www.jb51.net/html5/741102.html
