Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >【Web开发】纯前端实现科技企业官网首页

【Web开发】纯前端实现科技企业官网首页

作者头像
zstar
发布于 2022-06-14 01:15:57
发布于 2022-06-14 01:15:57
1.2K00
代码可运行
举报
文章被收录于专栏:往期博文往期博文
运行总次数:0
代码可运行

前言

本篇博文简单实现一个科技类产品官网的主页,图片素材来自于苹果官网。 相关教程参考自https://www.bilibili.com/video/BV117411n7R1 源代码下载:https://download.csdn.net/download/qq1198768105/85630862

功能概述

1、 在首页中,包含导航、轮播图、产品展示、特色介绍、产品介绍、用户信息获取和尾部等模块 2、 页面使用伪类实现交互效果 3、 在产品介绍中,有transition过渡效果 4、 使用网格布局(Grid)布局完成页面的自适应

用到的组件库

  • Anime:用来实现动画效果
  • Glide:实现轮播图效果
  • Isotope:实现产品展示中动态展示图片的效果
  • scrollReveal:实现滚动下拉时各元素渐入动画效果
  • smooth-scroll:实现点击菜单栏平滑滚动到相应模块的效果

视频演示效果

视频中未演示页面自适应效果。

苹果科技官网演示视频

核心代码

Html

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="./static/libs/scrollReveal/scrollreveal.min.js"></script>
    <!-- 设置图标 -->
    <link rel="icon" href="./static/images/icon.jpg" type="image/x-icon">
    <!-- 引入font-awesome依赖 -->
    <link href="https://cdn.bootcss.com/font-awesome/5.13.0/css/all.css" rel="stylesheet" />
    <link rel="stylesheet" href="./static/libs/glide/glide.core.min.css" />
    <link rel="stylesheet" href="./static/libs/glide/glide.theme.min.css" />
    <link rel="stylesheet" href="./style.css" />
    <title>Apple官网</title>
</head>

<body>
    <!-- 网页头部 -->
    <header>
        <div class="logo">苹果科技官网</div>
        <nav>
            <a href="#home">首页</a>
            <!-- <a href="#about-us">关于我们</a> -->
            <a href="#showcases">产品展示</a>
            <a href="#service">特色介绍</a>
            <a href="#team-intro">产品介绍</a>
            <a href="#company-activities">用户信息</a>
            <a href="#"><i class="fas fa-search"></i></a>
        </nav>
        <div class="burger">
            <div class="burger-line1"></div>
            <div class="burger-line2"></div>
            <div class="burger-line3"></div>
        </div>
    </header>
    <div id="home" class="glide">
        <!-- 轮播图区域 -->
        <div class="glide__track" data-glide-el="track">
            <div class="glide__slides">
                <!-- 轮播图一 -->
                <div class="glide__slide">
                    <div class="slide-caption left"></div>
                    <!-- 轮播图阴影遮罩 -->
                    <div class="backdrop"></div>
                    <img src="./static/images/phone1.jpg" />
                </div>
                <!-- 轮播图二 -->
                <div class="glide__slide">
                    <div class="slide-caption left"></div>
                    <!-- 轮播图阴影遮罩 -->
                    <div class="backdrop"></div>
                    <img src="./static/images/phone2.jpg" />
                </div>
                <!-- 轮播图三 -->
                <div class="glide__slide">
                    <div class="slide-caption left"></div>
                    <!-- 轮播图阴影遮罩 -->
                    <div class="backdrop"></div>
                    <img src="./static/images/phone3.jpg" />
                </div>
            </div>
            <div class="glide__arrows" data-glide-el="controls">
                <!-- 轮播图左侧按钮 -->
                <button class="glide__arrow glide__arrow--left" data-glide-dir="<">
                    <i class="fa fa-angle-left"></i>
                </button>
                <!-- 轮播图右侧按钮 -->
                <button class="glide__arrow glide__arrow--right" data-glide-dir=">">
                    <i class="fa fa-angle-right"></i>
                </button>
                <!-- 轮播图圆点 -->
                <div class="glide__bullets" data-glide-el="controls[nav]">
                    <button class="glide__bullet" data-glide-dir="=0"></button>
                    <button class="glide__bullet" data-glide-dir="=1"></button>
                    <button class="glide__bullet" data-glide-dir="=2"></button>
                </div>
            </div>
        </div>
    </div>
    <div class="content-wrapper">

        <!-- 产品展示 -->
        <!-- 根据不同的类别进行分组展示 -->
        <section id="showcases" class="showcases section-bg">
            <h2 class="title1">产品展示</h2>
            <div class="filter-btns">
                <button class="filter-btn active" data-filter="*">全部</button>
                <button class="filter-btn" data-filter=".web">iPhone</button>
                <button class="filter-btn" data-filter=".mobile">iPad</button>
                <button class="filter-btn" data-filter=".science">mac</button>
            </div>
            <div class="cases">
                <div class="case-item web">
                    <img src="./static/images/img1.jpg" alt="">
                </div>
                <div class="case-item web">
                    <img src="./static/images/img2.jpg" alt="">
                </div>
                <div class="case-item web">
                    <img src="./static/images/img3.jpg" alt="">
                </div>
                <div class="case-item web">
                    <img src="./static/images/img4.jpg" alt="">
                </div>
                <div class="case-item mobile">
                    <img src="./static/images/img6.jpg" alt="">
                </div>
                <div class="case-item science">
                    <img src="./static/images/img8.jpg" alt="">
                </div>
                <div class="case-item web">
                    <img src="./static/images/img5.jpg" alt="">
                </div>
                <div class="case-item mobile">
                    <img src="./static/images/img7.jpg" alt="">
                </div>
            </div>
        </section>

        <!-- 特色介绍 -->
        <!-- 图标网站 https://www.thinkcmf.com/font/font_awesome/icons.html -->
        <section id="service" class="service">
            <h2 class="title1">特色介绍</h2>
            <p class="intro">
                苹果公司是美国的一家电子科技公司
            </p>
            <div class="services">
                <div class="service-item">
                    <i class="fas fa-star"></i>
                    <h4 class="service-title">公司规模</h4>
                    <p class="service-content">
                        总市值达5600亿美元,位居全球第一。
                    </p>
                </div>
                <div class="service-item">
                    <i class="fas fa-chart-line"></i>
                    <h4 class="service-title">整合营销</h4>
                    <p class="service-content">
                        根据客户提出的需求进行评估,估算出相应的时间与费用。
                    </p>
                </div>
                <div class="service-item">
                    <i class="fas fa-shopping-cart"></i>
                    <h4 class="service-title">电子商务</h4>
                    <p class="service-content">
                        根据企业需求,开发不同的销售渠道,通过网上直销。
                    </p>
                </div>
                <div class="service-item">
                    <i class="fas fa-desktop"></i>
                    <h4 class="service-title">产品研发</h4>
                    <p class="service-content">
                        根据用户需求,完成软硬件产品开发。
                    </p>
                </div>
                <div class="service-item">
                    <i class="fas fa-anchor"></i>
                    <h4 class="service-title">创新能力</h4>
                    <p class="service-content">
                        把握时代的风口,不断打造现象级产品。
                    </p>
                </div>
                <div class="service-item">
                    <i class="fas fa-user-check"></i>
                    <h4 class="service-title">团队人数</h4>
                    <p class="service-content">
                        公司所有全职员工人数累积达240万。
                    </p>
                </div>
            </div>
        </section>
        <!--产品介绍 -->
        <section id="team-intro" class="team-intro section-bg">
            <h2 class="title1">产品介绍</h2>
            <p class="intro">最新产品简介</p>
            <div class="activities">
                <div class="activity">
                    <div class="act-image-wrapper">
                        <img src="./static/images/product1.jpg" alt="">
                    </div>
                    <div class="meta">
                        <p class="data-published">
                            <i class="far fa-calendar"></i> 202268</p>
                        <p class="comments">
                            <i class="far fa-comments"></i> 133
                            <span>条评论</span>
                        </p>
                    </div>
                    <h2 class="act-title">MacBook Air</h2>
                    <article>
                        M2 是新一代 Apple 芯片的开篇之作。它配备 8 核中央处理器,各种日常工作,比如创建文档或演示文稿,都能干脆利落搞定。即使是处理繁重任务,比如用 Xcode 进行开发、在 Logic Pro 中混音,也都不在话下。 M2 配备最多达 10 核图形处理器,图形性能大幅跃升;它的媒体处理引擎,让你可播放和剪辑多达 11 条 4K 视频流和 2 条 8K ProRes 视频流。
                    </article>
                    <button class="read-more-btn">阅读更多</button>
                </div>
                <div class="activity">
                    <div class="act-image-wrapper">
                        <img src="./static/images/product2.jpg" alt="">
                    </div>
                    <div class="meta">
                        <p class="data-published">
                            <i class="far fa-calendar"></i> 202268</p>
                        <p class="comments">
                            <i class="far fa-comments"></i> 63
                            <span>条评论</span>
                        </p>
                    </div>
                    <h2 class="act-title">iPad Air</h2>
                    <article>
                        Apple M1 芯片 8 核中央处理器 8 核图形处理器 Apple 神经网络引擎 8GB 内存1200 万像素广角摄像头,ƒ/1.8 光圈 最高可达 5 倍数码变焦 五镜式镜头 Focus Pixels 自动对焦 全景模式 (最高可达 6300 万像素) 智能 HDR 3 拍摄广色域的照片和实况照片 照片地理标记功能 自动图像防抖功能 连拍快照模式 图像拍摄格式:HEIFJPEG</article>
                    <button class="read-more-btn">阅读更多</button>
                </div>
                <div class="activity">
                    <div class="act-image-wrapper">
                        <img src="./static/images/product3.jpg" alt="">
                    </div>
                    <div class="meta">
                        <p class="data-published">
                            <i class="far fa-calendar"></i> 202268</p>
                        <p class="comments">
                            <i class="far fa-comments"></i> 233
                            <span>条评论</span>
                        </p>
                    </div>
                    <h2 class="act-title">iPhone 13 Pro</h2>
                    <article>
                        ProMotion 自适应刷新率技术,最高可达 120Hz HDR 显示 原彩显示 广色域 (P3) 触感触控 2000000:1 对比度 (典型) 1000 尼特最大亮度 (典型); 1200 尼特最大亮度 (HDR) 采用防油渍防指纹涂层 支持多种语言文字同时显示 A15 仿生芯片 全新 6 核中央处理器,具有 2 个性能核心和 4 个能效核心 全新 5 核图形处理器 全新 16 核神经网络引擎。
                    </article>
                    <button class="read-more-btn">阅读更多</button>
                </div>
            </div>
        </section>

        <!-- 用户信息获取 -->
        <section id="company-activities" class="company-activities">
            <h2 class="title1">用户信息获取</h2>
            <p class="intro">正在寻求帮助?</p>
            <div class="form-box">
                <form action="#company-activities" id="form">
                    <p class="form-p">姓名:<input class="form-input1" type="text"><label class="name_trip"></label></p>

                    <p class="form-p">联系方式: <input class="form-input2" type="text"><label class="name_trip"></label></p>

                    <div class="form-button">
                        <button class="read-more-btn">提交</button>
                    </div>
                </form>
            </div>
        </section>
    </div>
    <!-- 底部信息 -->
    <footer>
        <div class="footer-menus">
            <div class="contact-us">
                <p class="menu-title">联系我们</p>
                <p>地址:绍兴市越城区山阴路526</p>
                <p>邮编:312000</p>
                <p>传真:0575-88054011</p>
                <p>电子邮件:1529848495@qq.com</p>
            </div>
            <div class="service-menu footer-menu">
                <p class="menu-title">产品概览</p>
                <ul class="menu-items">
                    <li><a href="#">iPhone</a></li>
                    <li><a href="#">iPad</a></li>
                    <li><a href="#">Mac</a></li>
                    <li><a href="#">iPods</a></li>
                </ul>
            </div>
            <div class="service-menu footer-menu">
                <p class="menu-title">特色介绍</p>
                <ul class="menu-items">
                    <li><a href="#">公司规模</a></li>
                    <li><a href="#">整合营销</a></li>
                    <li><a href="#">电子商务</a></li>
                    <li><a href="#">产品研发</a></li>
                </ul>
            </div>
            <div class="service-menu footer-menu">
                <p class="menu-title">产品介绍</p>
                <ul class="menu-items">
                    <li><a href="#">MacBook Air</a></li>
                    <li><a href="#">iPad Air</a></li>
                    <li><a href="#">iPhone 13 Pro</a></li>
                </ul>
            </div>
            <div class="service-menu footer-menu">
                <p class="menu-title">帮助与支持</p>
                <ul class="menu-items">
                    <li><a href="#">帮助中心</a></li>
                    <li><a href="#">联系客服</a></li>
                    <li><a href="#">文档资源</a></li>
                </ul>
            </div>
            <p class="icp-info">ICPXXXXXXX</p>
            <p class="rights">&copy; 许鄣彬</p>
            <div class="scroll-to-top">
                <a href="#"><i class="fas fa-chevron-up"></i></a>
            </div>
        </div>
    </footer>
    <!-- 引入JS文件 -->
    <script src="./static/libs/anime/anime.min.js"></script>
    <script src="./static/libs/glide/glide.min.js"></script>
    <script src="./static/libs/isotope/isotope.pkgd.min.js"></script>
    <script src="./static/libs/smooth-scroll/smooth-scroll.polyfills.min.js"></script>
    <script src="./index.js"></script>
</body>

</html>

Js

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
const headerEl = document.querySelector("header"); //获取导航栏实例
const scrollToTop = document.querySelector(".scroll-to-top"); // 获取返回顶部按钮实例

// 导航栏固定监听
window.addEventListener("scroll", () => {
    // 获取导航栏高度
    let height = headerEl.getBoundingClientRect().height;
    // 如果向下滑动距离超过800,就将其滑下
    if (window.pageYOffset - height > 800) {
        if (!headerEl.classList.contains("sticky")) {
            headerEl.classList.add("sticky");
        }
    } else {
        headerEl.classList.remove("sticky");
    }
    // 如果向下滑动距离超过1000,显示返回顶部按钮
    if (window.pageYOffset > 1000) {
        scrollToTop.style.display = "block";
    } else {
        scrollToTop.style.display = "none";
    }
});

const glide = new Glide(".glide", {
    type: "carousel",
    startAt: 0,
    autoplay: 3500,
});


glide.mount();

// 产品展示 js
const isotope = new Isotope(".cases", {
    layoutMode: "fitRows",
    itemSelector: ".case-item",
});

const filterBtns = document.querySelector(".filter-btns");

filterBtns.addEventListener("click", (e) => {
    let { target } = e;
    const filterOption = target.getAttribute("data-filter");
    if (filterOption) {
        document
            .querySelectorAll(".filter-btn.active")
            .forEach((btn) => btn.classList.remove("active"));
        target.classList.add("active");

        isotope.arrange({ filter: filterOption });
    }
});

// 通用滑动出现动画配置项
const staggeringOption = {
    delay: 300,
    distance: "50px",
    duration: 500,
    easing: "ease-in-out",
    origin: "bottom",
};

// 设置特色介绍滑动动画效果,interval设置等待时间
ScrollReveal().reveal(".service-item", {...staggeringOption, interval: 300 });

// 设置产品介绍滑动动画效果,interval设置等待时间
ScrollReveal().reveal(".activity", {...staggeringOption, interval: 300 });

// 设置用户信息获取滑动动画效果,interval设置等待时间
ScrollReveal().reveal(".form-box", {...staggeringOption, interval: 300 });

// 设置点击导航栏区域流畅滚动效果
const scroll = new SmoothScroll(
    'nav a[href*="#"] , .scroll-to-top a[href*="#"]', {
        header: "header",
        offset: 50,
    }
);

// 监听窗口缩小时全局导航的开启状态
document.addEventListener("scrollStart", () => {
    if (headerEl.classList.contains("open")) {
        headerEl.classList.remove("open");
    }
})


// 折叠按钮事件
const burgerEl = document.querySelector(".burger");
burgerEl.addEventListener("click", () => {
    headerEl.classList.toggle("open");
})

CSS

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
/* 初始化所有样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Helvetica, "PingFang SC", "Microsoft Yahei", sans-serif;
    font-size: 14px;
}

img {
    width: 100%;
}

:root {
    --primary-color: #ff434f;
    --secondary-color: #e3e3e3;
    --text-color-lightest: #e7e9ec;
    --text-color-darker: #2e2e2e;
    --text-color-dark: #494949;
    --text-color-gray: #8b8b8b;
    --text-color-dark-gray: #727272;
    --text-color-light-gray: #c6c6c6;
    --backdrop-color: rgba(42, 42, 42, 0.7);
}


/* 栅格布局 */

header {
    width: 100vw;
    height: 80px;
    display: grid;
    padding: 0 40px;
    grid-template-columns: 1fr 2fr;
    align-content: center;
    position: relative;
    z-index: 100;
}

.logo {
    margin-top: -5px;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color-lightest);
}

header nav {
    justify-self: end;
}

header nav i {
    color: var(--text-color-lightest);
}

header nav a {
    color: var(--text-color-lightest);
    text-decoration: none;
    margin: 0 24px;
}

header.burger {
    display: none;
}


/* 固定导航栏 */

header.sticky {
    position: fixed;
    background-color: white;
    box-shadow: 0 0 18px rgba(0, 0, 0, 0.2);
    animation: dropDown 0.5s ease-in-out forwards;
}

header.sticky .logo,
header.sticky nav a,
header.sticky nav i {
    color: var(--text-color-darker);
}


/* 从上到下动画效果 */

@keyframes dropDown {
    from {
        transform: translateY(-100px);
    }
    to {
        transform: translateY(0);
    }
}


/* 轮播图 */

.glide {
    position: relative;
    top: -80px;
    z-index: 50;
}

.glide__slide img {
    width: 100vw;
    height: 100vh;
    /* 自动等比例缩放 */
    object-fit: cover;
}

.backdrop {
    background: var(--backdrop-color);
    z-index: 60;
    position: absolute;
    width: 100%;
    height: 8%;
    left: 0;
    top: 0;
    /* 遮罩透明度 */
    opacity: 0.5;
}


/* 内容区域 */


/* 通用样式 */

.content-wrapper {
    /* 一维排版 */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

section {
    /* 二维 */
    display: grid;
    /* 每个列的对齐方式 */
    justify-items: center;
    max-width: 1280px;
    padding: 0 80px;
}

.section-bg {
    position: relative;
}

.section-bg::before {
    content: "";
    display: block;
    position: absolute;
    background-color: #f9fbfb;
    width: 100vw;
    height: 100%;
    z-index: -1;
}

.title1 {
    font-size: 34px;
    color: var(--text-color-darker);
}

.title1::after {
    content: "";
    display: block;
    width: 80%;
    height: 4px;
    background-color: var(--primary-color);
    margin-top: 14px;
    transform: translateX(10%);
}

.intro {
    margin: 28px 0 60px 0;
    /* text-indent: 2em; */
    font-size: 18px;
    color: var(--text-color-dark-gray);
}


/* 成功案例 */

.showcases {
    padding-bottom: 10px;
    max-width: unset;
    padding: 0px;
}

.filter-btns {
    margin-top: 54px;
    margin-bottom: 38px;
}

.filter-btn {
    margin: 0 7px;
    background-color: var(--secondary-color);
    border: 0;
    color: var(--text-color-dark-gray);
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.4s;
}

.filter-btn:focus,
.filter-btn:active {
    outline: none;
}

.filter-btn.active,
.filter-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.showcases .cases {
    width: 100vw;
}

.showcases .case-item {
    width: 25vw;
    height: 20vw;
    overflow: hidden;
}

.case-item img {
    height: 100%;
    object-fit: cover;
}


/* 特色介绍 */

.service {
    padding-top: 80px;
}

.services {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
    column-gap: 38px;
    row-gap: 34px;
}

.service-item {
    display: grid;
    grid-template-areas: "icon title" "icon content";
    grid-template-columns: 70px 1fr;
    grid-template-rows: 1fr 3fr;
    padding: 24px;
    box-shadow: 0px 0px 18px rgba(0, 0, 0, 0.06);
}

.service-item i.fas {
    grid-area: icon;
    font-size: 42px;
    color: var(--primary-color);
    padding-top: 6px;
}

.service-item .service-title {
    grid-area: title;
    color: var(--text-color-darker);
    font-size: 24px;
}

.service-item .service-content {
    grid-area: content;
    color: var(--text-color-gray);
    line-height: 30px;
    font-size: 16px;
    margin-top: 8px;
}


/* 产品介绍 */

.company-activities {
    margin-top: 80px;
}

.activities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 24px;
}

.activity {
    box-shadow: 0px 0px 24px rgba(0, 0, 0, 0.1);
    padding: 24px;
    transition: 0.4s;
}

.act-image-wrapper {
    height: 255px;
    overflow: hidden;
    margin: -24px;
    margin-bottom: 0;
}

.act-image-wrapper img {
    min-height: 300px;
    object-fit: cover;
}

.activity .meta {
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--text-color-light-gray);
    font-size: 12px;
    display: flex;
}

.activity .meta>p:last-child {
    margin-left: 36px;
}

.act-title {
    color: var(--text-color-dark);
    font-size: 18px;
    margin-bottom: 16px;
}

.activity article {
    color: var(--text-color-gray);
    letter-spacing: 0.54px;
    line-height: 24px;
}

.read-more-btn {
    border: 0;
    color: white;
    background-color: var(--primary-color);
    padding: 6px 14px;
    margin-top: 24px;
    border-radius: 4px;
}

.activity:hover {
    transform: translateY(-20px) scale(1.05);
    box-shadow: 0px 0px 36px rgba(0, 0, 0, 0.1);
}


/* 用户信息获取 */

.name_trip {
    margin-left: 50px;
    color: red;
}

.form-box {
    box-shadow: 0px 0px 24px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.form-p {
    margin-top: 30px;
    margin-left: 20px;
    color: black;
}

.form-input1 {
    margin-left: 40px;
    border-radius: 5px;
    border-style: hidden;
    height: 30px;
    width: 150px;
    background-color: var(--text-color-lightest);
    outline: none;
    color: black;
    padding-left: 5px;
}

.form-input2 {
    margin-left: 10px;
    border-radius: 5px;
    border-style: hidden;
    height: 30px;
    width: 150px;
    background-color: var(--text-color-lightest);
    outline: none;
    color: black;
    padding-left: 5px;
}

.form-button {
    text-align: center;
    margin-top: 20px;
}


/* 底部信息 */

footer {
    margin-top: 124px;
    background-color: #181818;
    display: grid;
    justify-items: center;
    padding-top: 72px;
    padding-bottom: 24px;
}

.footer-menus {
    width: 100%;
    max-width: 1280px;
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    padding: 0 80px;
    position: relative;
}

.menu-title {
    font-size: 16px;
    color: white;
    font-weight: 500;
    margin-bottom: 20px;
}

.contact-us {
    justify-self: start;
    color: var(--text-color-lightest);
}

.contact-us p:not(:first-child) {
    padding-bottom: 16px;
}

.menu-items li {
    list-style: none;
    padding-bottom: 8px;
}

.menu-items li a {
    text-decoration: none;
    font-weight: 300;
    color: var(--text-color-lightest);
}

.icp-info {
    margin-top: 24px;
    margin-bottom: 16px;
}

.icp-info,
.rights {
    grid-column: 1 / -1;
    justify-self: center;
    color: white;
}

.scroll-to-top {
    display: none;
    position: relative;
    z-index: 300;
}

.scroll-to-top a {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    position: fixed;
    bottom: 60px;
    right: 30px;
}


/* 设置响应式布局 */

@media (max-width: 1100px) {
    header nav {
        display: none;
    }
    /* burger为折叠图标 */
    header .burger {
        display: block;
        position: relative;
        width: 20px;
        height: 6px;
        justify-self: end;
        cursor: pointer;
    }
    .burger-line1,
    .burger-line2,
    .burger-line3 {
        width: 20px;
        height: 2px;
        background-color: var(--text-color-lightest);
    }
    .burger-line1 {
        position: absolute;
        top: -6px;
    }
    .burger-line3 {
        position: absolute;
        top: 6px;
    }
    /* 导航栏展开样式 */
    header.open nav {
        display: grid;
        position: absolute;
        left: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        background-color: white;
        grid-auto-rows: max-content;
        justify-items: end;
        padding: 0 40px;
        opacity: 0;
        animation: slideDown 0.6s ease-out forwards;
    }
    header.open nav>* {
        font-size: 18px;
        margin: 4px 0;
        opacity: 0;
        color: var(--text-color-darker);
        animation: showMenu 0.5s linear forwards 0.4s;
    }
    header.opem nav>i.fas {
        margin-top: 10px;
    }
    header.open .burger-line1,
    header.open .burger-line2,
    header.open .burger-line3,
    header.sticky .burger-line1,
    header.sticky .burger-line2,
    header.sticky .burger-line3 {
        background-color: var(--text-color-darker);
        transform: 0.4s ease;
    }
    header.open .burger-line1 {
        transform: rotate(45deg) translate(3px, 5px);
    }
    header.open .burger-line2 {
        transform: translateX(5px);
        opacity: 0;
    }
    header.open .burger-line3 {
        transform: rotate(-45deg) translate(3px, -5px);
    }
    header.open .logo {
        z-index: 40;
        color: var(--text-color-darker);
    }
    @keyframes slideDown {
        from {
            height: 0;
            opacity: 0;
        }
        to {
            height: 100vh;
            padding-top: 80px;
            opacity: 1;
        }
    }
    @keyframes showMenu {
        from {
            opacity: 0;
            transform: translateY(-1vh);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    .service-item .service-title {
        font-size: 20px;
    }
    .service-item .service-content {
        font-size: 14px;
        line-height: 24px;
    }
    .activities {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 36px;
    }
}

@media(max-width: 992px) {
    .slide-caption h1 {
        font-size: 48px;
    }
    .slide-caption h3 {
        font-size: 18px;
    }
    .features,
    .services {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: unset;
    }
    .showcases .case-item {
        width: calc(100vw/3);
    }
}

@media(max-width: 768px) {
    section,
    .footer-menus {
        padding: 0 40px;
    }
    .footer-menus {
        grid-template-columns: 2fr repeat(2, 1fr);
        row-gap: 24px;
    }
    .contact-us {
        grid-row: 1 / 3;
    }
    .footer-menus {
        text-align: right;
    }
    .activities {
        grid-template-columns: 1fr;
        row-gap: 36px;
    }
    .features,
    .services {
        grid-template-columns: 1fr;
    }
    .showcases .case-item {
        width: calc(100vw /2);
        height: 30vw;
    }
}

@media(max-width: 576px) {
    .slide-caption h1 {
        font-size: 28px;
    }
    .slide-caption h3 {
        font-size: 14px;
    }
    .explore-btn {
        font-size: 14px;
        padding: 8px 18px;
    }
    .showcases .case-item {
        width: 100vw;
        height: 60vw;
    }
    .footer-menus {
        grid-template-columns: 1fr;
    }
    .footer-menus {
        justify-self: start;
        text-align: left;
    }
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-06-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Spring AOP(一) AOP基本概念
 Spring框架自诞生之日就拯救我等程序员于水火之中,它有两大法宝,一个是IoC控制反转,另一个便是AOP面向切面编程。今日我们就来破一下它的AOP法宝,以便以后也能自由使出一手AOP大法。
程序员历小冰
2019/02/11
4770
Spring AOP(一) AOP基本概念
Spring Boot 2.X(八):Spring AOP 实现简单的日志切面
AOP 的全称为 Aspect Oriented Programming,译为面向切面编程,是通过预编译方式和运行期动态代理实现核心业务逻辑之外的横切行为的统一维护的一种技术。AOP 是面向对象编程(OOP)的补充和扩展。 利用 AOP 可以对业务逻辑各部分进行隔离,从而达到降低模块之间的耦合度,并将那些影响多个类的公共行为封装到一个可重用模块,从而到达提高程序的复用性,同时提高了开发效率,提高了系统的可操作性和可维护性。
朝雾轻寒
2019/10/18
1.6K0
Spring Boot 2.X(八):Spring AOP 实现简单的日志切面
SpringBoot AOP 记录日志实例
面向切面编程(AOP是Aspect Oriented Program的首字母缩写) ,我们知道,面向对象的特点是继承、多态和封装。而封装就要求将功能分散到不同的对象中去,这在软件设计中往往称为职责分配。
一个会写诗的程序员
2018/08/17
1.9K0
SpringBoot AOP 记录日志实例
极简SpringBoot指南-Chapter05-SpringBoot中的AOP面向切面编程简介
w4ngzhen/springboot-simple-guide: This is a project that guides SpringBoot users to get started quickly through a series of examples (github.com)
w4ngzhen
2023/10/17
1670
Spring Boot---(25)SpringBoot使用AOP
摘要:本文示例,是在一个简单的SpringBoot项目中,通过AOP技术,来实现对接口访问时的信息统计,和接口耗时统计。
IT云清
2019/01/22
5820
深入理解AOP思想
概念 : AOP为Aspect Oriented Programming的缩写, 意思为切面编程。
用户11097514
2024/05/30
1110
深入理解AOP思想
逐行阅读Spring5.X源码(十一)AOP概念、应用、原理
与OOP对比,面向切面,传统的OOP开发中的代码逻辑是自上而下的,而这些过程会产生一些横切性问题,这些横切性的问题和我们的主业务逻辑关系不大,这些横切性问题不会影响到主逻辑实现的,但是会散落到代码的各个部分,难以维护。AOP是处理一些横切性问题,AOP的编程思想就是把这些问题和主业务逻辑分开,达到与主业务逻辑解耦的目的。使代码的重用性和开发效率更高。
源码之路
2020/09/04
8960
逐行阅读Spring5.X源码(十一)AOP概念、应用、原理
基于SpringBoot使用AOP技术实现操作日志管理[通俗易懂]
文章大致内容: 1、基本概念 2、基本应用 3、日志管理实战 对这几部分理解了,会对AOP的应用应该很轻松。
全栈程序员站长
2022/09/05
7310
基于SpringBoot使用AOP技术实现操作日志管理[通俗易懂]
Spring AOP 详解
出处:http://www.cnblogs.com/frankliiu-java/archive/2010/01/05/1639664.html
全栈程序员站长
2021/05/19
3940
Spring Boot AOP 扫盲
大家好,我是二哥呀。AOP 是 Spring 体系中非常重要的两个概念之一(另外一个是 IoC),今天这篇文章就来带大家通过实战的方式,在编程猫 SpringBoot 项目中使用 AOP 技术为 controller 层添加一个切面来实现接口访问的统一日志记录。
沉默王二
2022/03/07
5480
Spring Boot AOP 扫盲
Spring 框架学习(八)——AOP 的认识与使用
通知类型就是想要加的代码(校验、日志等) 是在对象方法的前面还是后面执行的类型,这就是通知类型。
RAIN7
2022/07/09
5200
Spring 框架学习(八)——AOP 的认识与使用
Spring 详解(二)------- AOP关键概念以及两种实现方式
当我们为系统做参数验证,登录权限验证或者日志操作等,为了实现代码复用,我们可能把日志处理抽离成一个新的方法。但是这样我们仍然必须手动插入这些方法,这样的话模块之间高耦合,不利于后期的维护和功能的扩展,有了 AOP 我们可以将功能抽成一个切面,代码复用好,低耦合。
海向
2019/09/23
6630
Spring 详解(二)------- AOP关键概念以及两种实现方式
(14)SpringBoot使用AOP
   摘要:本文示例,是在一个简单的SpringBoot项目中,通过AOP技术,来实现对接口访问时的信息统计,和接口耗时统计。
IT云清
2022/05/07
1.4K0
(14)SpringBoot使用AOP
SpringBoot 利用 AOP 记录日志
Aspect Oriented Programming 面向切面编程。解耦是程序员编码开发过程中一直追求的。AOP也是为了解耦所诞生。
JAVA日知录
2020/05/25
1.9K0
给SpringBoot接口加全局日志(AOP)
一想到,每个接口都需要加一个开始时间和一个结束时间,我就感觉特别烦,就是不想撸代码。
猿码优创
2019/07/27
2K0
Spring Boot2(六):使用Spring Boot整合AOP面向切面编程
众所周知,spring最核心的两个功能是aop和ioc,即面向切面和控制反转。本文会讲一讲SpringBoot如何使用AOP实现面向切面的过程原理。
鸟不拉屎
2019/07/04
11.2K0
Spring boot中使用aop详解
aop是spring的两大功能模块之一,功能非常强大,为解耦提供了非常优秀的解决方案。
天涯泪小武
2019/01/17
1.4K0
Spring学习笔记 AOP
AOP,也就是面向方面编程或者说面向面编程,是一种很重要的思想。在企业级系统中经常需要打印日志、事务管理这样针对某一方面的需求,但是传统的面向对象编程无法很好的满足这些需求。因此催生了面向切面编程这样的思想。面向切面编程,通过动态代理这样的功能,向要执行的方法添加钩子,能够在不改动原方法的情况下,动态添加新功能。所以在现代系统中算是一项必需的功能了。Spring框架也很好的支持了AOP。
乐百川
2022/05/05
4530
spring AOP日志管理
Spring AOP 完成日志记录 SpringAOPAspectJsecurity日志记录 Spring AOP 完成日志记录 1、技术目标 掌握Spring AOP基本用法 使用Spring AOP完成日志记录功能 2、什么是AOP AOP是Aspect Oriented Programming的缩写,意思是面向方面编程,AOP实际是GoF设计模式的延续 注意:关于AOP的详细介绍不是本文重点 3、关于Spring AOP的一些术语 切面(Aspect):在Spring AOP中,切面
用户1212940
2018/01/23
1.8K0
Spring面向切面编程
第1章主要介绍了Spring管理实体对象的应用,通过ApplicationContext容器来了解Spring管理实体对象的原理以及设值注入、构造方法及自动注入等不同的注入方式。本章先介绍为什么需要AOP以及使用AOP的好处,然后采用手动代理的方式介绍什么是代理及代理的必要性,最后结合商场手机进货和收获的案例分别介绍前置通知、后置通知、环绕通知和异常通知。在介绍前置通知的时候,分别采用Spring1.x和Spring2.x的方式进行配置,为后续课程的学习打下铺垫。
张哥编程
2024/12/17
960
推荐阅读
相关推荐
Spring AOP(一) AOP基本概念
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验