当前位置: 首页 > article >正文

css-50 Projects in 50 Days(3)

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

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

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')
}


http://www.kler.cn/a/397727.html

相关文章:

  • GEE下载ERA5-Land气象数据(1950-至今,降水、温度)
  • 创建vue+electron项目流程
  • 对称加密算法DES的实现
  • 速通前端篇 —— HTML
  • shell编程--永久环境变量和字符串显位
  • Python毕业设计选题:基于django+vue的二手物品交易系统
  • 屏幕拾色器
  • GESP4级考试语法知识(贪心算法(四))
  • 从二维到一维:动态规划矩阵问题的优化之道
  • spring-cache concurrentHashMap 自定义过期时间
  • 将 HTML 转换为 JSX:JSX 和 JSX 规则
  • 【项目开发】分析六种常用软件架构
  • ISCTF2024
  • 算法沉淀一:双指针
  • 【Android Compose原创组件】可拖动滚动条的完美实现
  • 算法:快排(三指针算法)
  • YashanDB 23.2.3安装过程,并使用DBeaver进行连接
  • 【如何获取股票数据47】Python、Java等多种主流语言实例演示获取股票行情api接口之沪深指数历史分时KDJ数据获取实例演示及接口API说明文档
  • windows C#-创建记录类型(下)
  • Vue3 -- 项目配置之eslint【企业级项目配置保姆级教程1】
  • mysql数据迁移PolarDB
  • ubuntu安装 Pycharm
  • Prometheus面试内容整理-数据持久化和高可用
  • cocosCreator视频web模式播放踩坑解决
  • 分页查询我的课表
  • 性能高于Transformer模型1.7-2倍,彩云科技发布基于DCFormer架构通用大模型云锦天章