超酷的模态框效果 - Nifty

所属分类:UI-弹出层

 74460  510  查看评论 (19)
分享到微信朋友圈
X
超酷的模态框效果 - Nifty ie兼容9

简介

Nifty Modal Window Effects 为我们提供了多种弹出效果的模态框,通过CSS3实现。


用法

首先我们将下面元素添加到body中

<div class="md-modal md-effect-1" id="modal-1">
    <div class="md-content">
        <h3>Modal Dialog</h3>
        <div>
            <p>This is a modal window. You can do the following things with it:</p>
            <ul>
                <li><strong>Read:</strong> Modal windows will probably tell you something important so don't forget to read what it says.</li>
                <li><strong>Look:</strong> modal windows enjoy a certain kind of attention; just look at it and appreciate its presence.</li>
                <li><strong>Close:</strong> click on the button below to close the modal.</li>
            </ul>
            <button class="md-close">Close me!</button>
        </div>
    </div>
</div>
 
...
 
<div class="md-overlay"></div>

该效果主要是通过 CSS3完成的,以下是相关的CSS代码:

.md-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 50%;
    max-width: 630px;
    min-width: 320px;
    height: auto;
    z-index: 2000;
    visibility: hidden;
    backface-visibility: hidden;
    transform: translateX(-50%) translateY(-50%);
}
 
.md-show {
    visibility: visible;
}
 
.md-overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    visibility: hidden;
    top: 0;
    left: 0;
    z-index: 1000;
    opacity: 0;
    background: rgba(143,27,15,0.8);
    transition: all 0.3s;
}
 
.md-show ~ .md-overlay {
    opacity: 1;
    visibility: visible;
}

.md-perspective,
.md-perspective body {
    height: 100%;
    overflow: hidden;
}
 
.md-perspective body  {
    background: #222;
    perspective: 600px;
}
 
.container {
    background: #e74c3c;
    min-height: 100%;
}

/* Effect 5: newspaper */
.md-show.md-effect-5 ~ .md-overlay {
    background: rgba(0,127,108,0.8);
}
 
.md-effect-5 .md-content {
    transform: scale(0) rotate(720deg);
    opacity: 0;
    transition: all 0.5s;
}
 
.md-show.md-effect-5 .md-content {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}

注意,该效果只能在现代浏览器中使用,不支持老版本的浏览器,请根据自己的需求使用。

===========以下代码由  create_time  提供===============

楼上的方法缺了,我在这里补上,如何更改,里面的颜色,component.css,里面的,.md-trigger 是通用的样式,如果要,又多样式得自己拓展。引入你下载的js文件,和css文件,里面的,default是布局样式,component.css按钮样式。

相关插件-弹出层

jQuery弹出层插件

可无限次弹出,自己设置大小,手动调整大小都可(相比于layer.js要轻量)
  弹出层
 38661  318

表格鼠标移入同行同列变色(原创)

jQuery表格鼠标移入后同行同列变色
  弹出层
 26113  320

jquery网站功能介绍步骤

网站功能介绍步骤,可以引导用户该怎么操作,或者应该做什么
  弹出层
 38332  453

jQuery html5爆裂式登录效果

HTML5爆裂式关闭窗口动画登录模板,关闭窗口撕开动画效果。
  弹出层
 50790  577

讨论这个项目(19)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

    无别 0
    2020/12/10 18:25:58
    兼容性极差,使用复杂 回复
    0
    2019/12/9 10:16:27
    导入js一直找不到怎么回事
        BattleofLexington1
        2019/12/9 10:20:15
        f12会提示错误路径地址,查找修改对应的就行了。
        0
        2019/12/9 10:48:55

        我就是按了F12看见的

        index.jsp:13 GET http://localhost:8080/p2p/js/jquerymtk/js/modernizr.custom.js net::ERR_ABORTED 404
        index.jsp:337 GET http://localhost:8080/p2p/js/jquerymtk/js/classie.js net::ERR_ABORTED 404
        index.jsp:338 GET http://localhost:8080/p2p/js/jquerymtk/js/modalEffects.js net::ERR_ABORTED 404
        index.jsp:347 GET http://localhost:8080/p2p/js/jquerymtk/js/css-filters-polyfill.js net::ERR_ABORTED 404
        index.jsp:346 GET http://localhost:8080/p2p/js/jquerymtk/js/cssParser.js net::ERR_ABORTED 404
        index.jsp:337 GET http://localhost:8080/p2p/js/jquerymtk/js/classie.js net::ERR_ABORTED 404
        index.jsp:338 GET http://localhost:8080/p2p/js/jquerymtk/js/modalEffects.js net::ERR_ABORTED 404
        index.jsp:346 GET http://localhost:8080/p2p/js/jquerymtk/js/cssParser.js net::ERR_ABORTED 404
        2index.jsp:347 GET http://localhost:8080/p2p/js/jquerymtk/js/css-filters-polyfill.js net::ERR_ABORTED 404
        index.jsp:1 GET http://localhost:8080/p2p/fonts/cosicons/cosicons.ttf net::ERR_ABORTED 404

        这些路径都没有错呀

        BattleofLexington0
        2019/12/9 11:07:40

        应该是编译问题,百度ERR_ABORTED 404很多解决方案的。

    回复
    ─━ㄔqunar夏姬ζ 0
    2018/8/29 3:27:11
    怎么改变背景颜色 回复
    颠覆世界的一个人 0
    2018/5/31 21:46:48
    其实我想,这个弹出模态框是不是css做到的,因为感觉用css写会很容易的 回复
    Robin?? 0
    2017/6/10 14:05:15
    ら"╉?他色忧?╃ 0
    2016/12/8 15:12:07
    不支持frameset框架 回复
    ら"╉?他色忧?╃ 0
    2016/12/8 14:12:00
    这个弹窗需要刷新页面好坑啊,不能无刷新弹出嘛?页面一刷新控制器全乱了 回复
    SiriBen 0
    2016/9/30 18:09:10
    效果确实好,但是最好是能把这些尽量做到JS调用中去,这样程序才好动态,不然去处理CSS太蛋疼了 回复
    巴尔墨尉 0
    2016/9/27 13:09:36
    尼玛这个好啊,各种都有了 回复
    喵咪老师 0
    2016/7/7 18:07:30
    用了这个弹窗,程序那边调取不到。是动态调取。就想知道程序如何动态调取,判断当前状态,调取不同的弹窗。? 回复
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复