css-50 Projects in 50 Days(3)

html

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旋转页面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"
        integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog=="
        crossorigin="anonymous">
    <link rel="stylesheet" href="./style.css">

</head>

<body>
    <div id="container" class="container">

        <div class="content_wrapper">

            <div class="content">
                <div class="fs30 fw600 mt20 ">Amazing Article</div>
                <div class="fs16 cr_555 italic">Florin Pop</div>
                <p class="cr_555">Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium quia in ratione
                    dolores cupiditate,
                    maxime aliquid impedit dolorem nam dolor omnis atque fuga labore modi veritatis porro laborum minus,
                    illo, maiores recusandae cumque ipsa quos. Tenetur, consequuntur mollitia labore pariatur sunt quia
                    harum aut. Eum maxime dolorem provident natus veritatis molestiae cumque quod voluptates ab non,
                    tempore
                    cupiditate? Voluptatem, molestias culpa. Corrupti, laudantium iure aliquam rerum sint nam quas dolor
                    dignissimos in error placeat quae temporibus minus optio eum soluta cupiditate! Cupiditate saepe
                    voluptates laudantium. Ducimus consequuntur perferendis consequatur nobis exercitationem molestias
                    fugiat commodi omnis. Asperiores quia tenetur nemo ipsa.

                </p>
                <h3>My Xxx</h3>
                <img src="https://fastly.picsum.photos/id/866/1000/666.jpg?hmac=2bUfqZW-BtFbQv1wQf9cZrTnbI-mKI3cR5QJw4d4ycI"
                    alt="" srcset="" />
                <p class="cr_555">Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sit libero deleniti rerum
                    quo,
                    incidunt vel consequatur culpa ullam. Magnam facere earum unde harum. Ea culpa veritatis magnam at
                    aliquid. Perferendis totam placeat molestias illo laudantium? Minus id minima doloribus dolorum
                    fugit
                    deserunt qui vero voluptas, ut quia cum amet temporibus veniam ad ea ab perspiciatis, enim accusamus
                    asperiores explicabo provident. Voluptates sint, neque fuga cum illum, tempore autem maxime
                    similique
                    laborum odio, magnam esse. Aperiam?

                </p>
            </div>
        </div>


    </div>
    <div id="left" class="left ">
        <div class="item"> <span class="fas fa-home mr8"></span><span>Home</span></div>

        <div class="item"><span class="fas fa-user-alt mr8"></span> <span>About</span></div>

        <div class="item"><span class="fas fa-envelope mr8"></span> <span>Contact</span></div>
    </div>
    <div id="rotate" class="rotate cur">
        <div class="rotate_item">
            <span class="fas fa-times"></span>
        </div>

        <div class="rotate_item">
            <span class="fas fa-bars"></span>
        </div>

    </div>
    <script src="./index.js"></script>
</body>

</html>

css

css 复制代码
html,
body {
    padding: 0;
    margin: 0;
    background-color: #333;
}

.fs30 {
    font-size: 30px;
}

.fs24 {
    font-size: 24px;
}

.fs16 {
    font-size: 16px;
}

.mt20 {
    margin-top: 20px;
}

.mt32 {
    margin-top: 32px;
}

.mb32 {
    margin-bottom: 32px;
}

.mb6 {
    margin-bottom: 6px;
}

.mr8 {
    margin-right: 8px;
}

.fw600 {
    font-weight: 600;
}

.cr_555 {
    color: #555;
}

.cr_999 {
    color: #999;
}

.italic {
    font-style: italic;
}

.cur {
    cursor: pointer;
}

.container_active {
    transform: rotate(-20deg);
}

.container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    background-color: #fafafa;
    transition: all 0.5s ease;
    transform-origin: top left;

    .content_wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;


        .content {
            padding: 50px;
            margin: 50px auto;
            max-width: 1000px;

        }

        .content_active {
            transform: rotate(20deg);
        }
    }



}


.left {
    bottom: 40px;
    position: fixed;
    z-index: 100;
    padding: 0%;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 30px;

    .item {
        transition: transform 0.4s ease-in;

    }

    .item:nth-of-type(1) {
        padding-left: 0;
        transform: translateX(-100%);
    }

    .item:nth-of-type(2) {
        padding-left: 15px;
        transform: translateX(-150%);
    }

    .item:nth-of-type(3) {
        padding-left: 30px;
        transform: translateX(-200%);
    }

}

.left_active {
    .item {
        transition: transform 0.4s ease-in;
        transition-delay: 0.3s;
    }

    .item:nth-of-type(1) {
        transform: translateX(0%);
    }

    .item:nth-of-type(2) {
        transform: translateX(0%);
    }

    .item:nth-of-type(3) {
        transform: translateX(0%);
    }
}

.rotate {
    $w: 26px;
    position: absolute;
    left: -100px;
    top: -100px;
    width: 200px;
    height: 200px;
    background-color: #ff7979;
    border-radius: 50%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 100px;
    font-size: 26px;
    color: #fff;
    transition: all 0.5s ease;
    transform: rotate(0);

    .rotate_item {
        position: relative;


    }

    .rotate_item:nth-of-type(1) {
        width: 100%;
        height: 100%;
        grid-row: 2/2;

        span {
            position: absolute;
            left: 50%;
            top: 30%;
        }

    }

    .rotate_item:nth-of-type(2) {
        width: 100%;
        height: 100%;
        grid-row: 2/2;
        grid-column: 2/2;

        span {
            position: absolute;
            left: 30%;
            top: 30%;
        }
    }
}

.rotate_active {
    transform: rotate(-90deg);
}

js

javascript 复制代码
const state = {
    containerBox: document.querySelector('#container'),
    rotateBox: document.querySelector('#rotate'),
    leftBox: document.querySelector('#left'),
}

state.rotateBox.onclick = () => {
    state.containerBox.classList.toggle('container_active')
    state.leftBox.classList.toggle('left_active')
}
相关推荐
涔溪13 分钟前
Ecmascript(ES)标准
前端·elasticsearch·ecmascript
榴莲千丞24 分钟前
第8章利用CSS制作导航菜单
前端·css
奔跑草-29 分钟前
【前端】深入浅出 - TypeScript 的详细讲解
前端·javascript·react.js·typescript
羡与40 分钟前
echarts-gl 3D柱状图配置
前端·javascript·echarts
guokanglun40 分钟前
CSS样式实现3D效果
前端·css·3d
咔咔库奇1 小时前
ES6进阶知识一
前端·ecmascript·es6
渗透测试老鸟-九青1 小时前
通过投毒Bingbot索引挖掘必应中的存储型XSS
服务器·前端·javascript·安全·web安全·缓存·xss
龙猫蓝图1 小时前
vue el-date-picker 日期选择器禁用失效问题
前端·javascript·vue.js
fakaifa1 小时前
CRMEB Pro版v3.1源码全开源+PC端+Uniapp前端+搭建教程
前端·小程序·uni-app·php·源码下载
夜色呦2 小时前
掌握ECMAScript模块化:构建高效JavaScript应用
前端·javascript·ecmascript