原生js实现toast弹出提示效果代码

代码语言:html

所属分类:弹出层

代码描述:原生js实现toast弹出提示效果代码

代码标签: toast 弹出 提示 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">



    <style>
        body {
            font-size: 18px;
            line-height: 1.5;
            background: #eee;
            color: #333;
            height: 100vh;
            width: 100vw;
            display: -webkit-box;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            flex-flow: column;
            -webkit-box-align: center;
            align-items: center;
            -webkit-box-pack: center;
            justify-content: center;
        }

        h1 {
            box-sizing: border-box;
            width: 100%;
            max-width: 768px;
            margin: 0 auto;
            text-align: center;
            text-transform: uppercase;
            text-decoration: underline;
        }

        .toast {
            cursor: pointer;
            box-sizing: border-box;
            display: none;
            width: 100%;
            max-width: 640px;
            font-size: 0.825em;
            border-top-right-radius: 5px;
            border-top-left-radius: 5px;
            background: #ffffff;
            box-shadow: 0 2.8px 2.2px rgba(0, 0, 0, 0.02), 0 6.7px 5.3px rgba(0, 0, 0, 0.028), 0 12.5px 10px rgba(0, 0, 0, 0.035), 0 22.3px 17.9px rgba(0, 0, 0, 0.042), 0 41.8px 33.4px rgba(0, 0, 0, 0.05), 0 100px 80px rgba(0, 0, 0, 0.07);
            -webkit-transition: 0.2s ease-in;
            transition: 0.2s ease-in;
        }
@media (min-width: 640px) {
            .toast {
                border-radius: 5px;
                margin-bottom: 0.5em;
            }
        }
        .toast--active {
            display: -webkit-box;
            display: flex;
            -webkit-animation: slidein--bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
            animation: slidein--bottom 0.5s cubic-bezier(.........完整代码请登录后点击上方下载按钮下载查看

网友评论0