当前位置: 代码网 > it编程>网页制作>html5 > AmazeUI中模态框的实现

AmazeUI中模态框的实现

2020年08月19日 html5 我要评论
AmazeUI中模态框的实现这篇文章主要介绍了AmazeUI中模态框的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 20-08-19

本文与《【ratchet】模态框》()为姊妹篇,相比之下,amazeui的模态框,更加接近于一个alert(),不适合承载过多的内容,但是其优点就是可以通过js操控,ratchet仅能通过超级链接a标签打开。

amazeui的模态框效果如下:

完全就如同某些手机浏览器对alert()的处理。其现实代码如下:

<!--使用html5开发-->
<!doctype html>
<html class="no-js">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <!--自动适应移动屏幕-->
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!--优先使用webkit内核渲染-->
        <meta name="renderer" content="webkit">
        <!--不要被百度转码-->
        <meta http-equiv="cache-control" content="no-siteapp"/>
        <!--以下才是引入amazeui资源-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <!--引入js的时候要注意,必须先引入jquery,再引入amazeui,因为这个框架是基于jquery开发的-->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/amazeui.min.js"></script>
        <title>modal</title>
    </head>    
    <body>
        <button class="am-btn am-btn-primary" οnclick="openmodal()">打开模态框</button>
        
        <div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
            <div class="am-modal-dialog">
                <div class="am-modal-bd">
                    模态框的内容
                </div>
                <div class="am-modal-footer">
                 <span class="am-modal-btn">关闭</span>
                </div>
            </div>
        </div>
    </body>
</html>
<script>
function openmodal(){
 $('#my-alert').modal();
}
</script>

注意到,这个id为my-alert的模态框,是通过button的onclick事件所触发的openmodal()函数触发的。

其js打开模态框的代码就一行,先获取了模态框的id之后,通过modal()方法打开。

到此这篇关于amazeui中模态框的实现的文章就介绍到这了,更多相关amazeui模态框内容请搜索代码网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com