一款基于jquery超炫的弹出层提示消息

今天给大家带来一款基于jquery超炫的弹出层提示消息。这款实例页面初始时,一个go按钮。当单击go按钮时,提示强出层以动画形式出现。效果图如下:

在线预览   源码下载

实现的代码。

html代码:

  <div class='b'>
    </div>
    <div class='bb'>
    </div>
    <button id='go'>
        GO
    </button>
    <div class='message'>
        <div class='check'>
            &#10004;
        </div>
        <p>
            Success
        </p>
        <p>
            Check your email for a booking confirmation. We'll see you soon!
        </p>
        <button id='ok'>
            OK
        </button>
    </div>
    <script src='jquery.js'></script>
    <script>
        $('#go').click(function () {
            go(50);
        });
        $('#ok').click(function () {
            go(500);
        });
        setTimeout(function () {
            go(50);
        }, 700);
        setTimeout(function () {
            go(500);
        }, 2000);
        function go(nr) {
            $('.bb').fadeToggle(200);
            $('.message').toggleClass('comein');
            $('.check').toggleClass('scaledown');
            $('#go').fadeToggle(nr);
        }
        //@ sourceURL=pen.js
    </script>

css代码:

  body, html
        {
            height: 100%;
            font-size: 20px;
            font-family: Source Sans Pro;
        }
        
        .b, .bb
        {
            position: absolute;
            width: 100%;
            height: 100%;
            background: url("kje4L5j.jpg");
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
        }
        
        .bb
        {
            background: url("bDBs0et.jpg");
            background-attachment: fixed;
            background-size: cover;
            background-position: center;
            display: none;
        }
        
        #go
        {
            position: absolute;
            top: 30px;
            left: 50%;
            transform: translate(-50%, 0%);
            color: white;
            border: 0;
            background: #71c341;
            width: 100px;
            height: 30px;
            border-radius: 6px;
            font-size: 1rem;
            transition: background 0.2s ease;
            outline: none;
        }
        #go:hover
        {
            background: #8ecf68;
        }
        #go:active
        {
            background: #5a9f32;
        }
        
        .message
        {
            position: absolute;
            top: -200px;
            left: 50%;
            transform: translate(-50%, 0%);
            width: 300px;
            background: white;
            border-radius: 8px;
            padding: 30px;
            text-align: center;
            font-weight: 300;
            color: #2c2928;
            opacity: 0;
            transition: top 0.3s cubic-bezier(0.31, 0.25, 0.5, 1.5), opacity 0.2s ease-in-out;
        }
        .message .check
        {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translate(-50%, -50%) scale(4);
            width: 120px;
            height: 110px;
            background: #71c341;
            color: white;
            font-size: 3.8rem;
            padding-top: 10px;
            border-radius: 50%;
            opacity: 0;
            transition: transform 0.2s 0.25s cubic-bezier(0.31, 0.25, 0.5, 1.5), opacity 0.1s 0.25s ease-in-out;
        }
        .message .scaledown
        {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }
        .message p
        {
            font-size: 1.1rem;
            margin: 25px 0px;
            padding: 0;
        }
        .message p:nth-child(2)
        {
            font-size: 2.3rem;
            margin: 40px 0px 0px 0px;
        }
        .message #ok
        {
            position: relative;
            color: white;
            border: 0;
            background: #71c341;
            width: 100%;
            height: 50px;
            border-radius: 6px;
            font-size: 1.2rem;
            transition: background 0.2s ease;
            outline: none;
        }
        .message #ok:hover
        {
            background: #8ecf68;
        }
        .message #ok:active
        {
            background: #5a9f32;
        }
        
        .comein
        {
            top: 150px;
            opacity: 1;
        }

via:http://***/Article/13018

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用jQuery插件来制作出层提示消息特效,比较常用的插件包括: 1. jQuery UI Dialog:是一个基于 jQuery UI 的出框组件,可以轻松创建出框和对话框。具有许多自定义选项和主题,可以在其官方文档中找到。 2. Bootstrap Modal:Bootstrap 是一个流行的前端框架,Modal 是其中的一个出层组件。它具有灵活的选项,可以自定义标题、内容和按钮等。 3. SweetAlert:是一个出框插件,具有简单易用的 API 和漂亮的设计。可以轻松创建各种出框,包括警告、确认和输入框。 这些插件都可以通过引入相应的 CSS 和 JavaScript 文件来使用。例如,引入 jQuery UI Dialog 的代码如下: ```html <!-- 引入 jQueryjQuery UI --> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css"> <!-- 创建一个按钮 --> <button id="myButton">点击出层</button> <!-- 引入 JavaScript 文件并初始化 Dialog --> <script src="path/to/jquery-ui-dialog.js"></script> <script> $(function() { $("#myButton").on("click", function() { $("#myDialog").dialog(); }); }); </script> <!-- 创建一个出层 --> <div id="myDialog" title="提示"> <p>这是一个出层。</p> </div> ``` 这样就可以创建一个简单的出层提示消息特效。如果需要更多自定义选项,可以查阅相关的官方文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值