目录
视频地址
项目效果地址
项目要做成这个样子
我先放代码,代码的结构是这样的
swiper中的内容我们后面会提到,charge_learn是充电学习的css与js,employment_guidance是就业指导的css与js
index.html
- html>
- <html lang="en">
-
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport"
- content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
- <link rel="stylesheet" href="css/initialization.css">
- <link rel="stylesheet" href="css/index.css">
-
- <link rel="stylesheet" href="css/swiper/swiper.min.css">
- <link rel="stylesheet" href="css/swiper/swiper-bundle.min.css">
- <link rel="stylesheet" href="css/employment_guidance/rotate.css">
- <link rel="stylesheet" href="css/employment_guidance/rotate_btn.css">
-
- <link rel="stylesheet" href="css/charge_learn/rotate.css">
-
- <title>Documenttitle>
- head>
-
- <body>
- <section class="header">黑马面面section>
- <section class="nav">
- <a href="#">
- <span>span>
- <span>HR面试span>
- a>
- <a href="#">
- <span>span>
- <span>笔试span>
- a>
- <a href="#">
- <span>span>
- <span>技术测试span>
- a>
- <a href="#">
- <span>span>
- <span>模拟面试span>
- a>
- <a href="#">
- <span>span>
- <span>面试技巧span>
- a>
- <a href="#">
- <span>span>
- <span>薪资查询span>
- a>
- section>
- <section class="banner">section>
- <section class="teach_work">
- <div class="teach_work_header">
- <span><img src="images/i2.png" alt="">就业指导span>
- <a href="#">更多>>a>
- div>
-
-
- <div class="swiper-container teach_work_mySwiper">
- <div class="swiper-wrapper ">
- <div class="swiper-slide">
- <img src="upload/pic.png" alt="">
- <p>老师教你应对面试技巧p>
- div>
- <div class="swiper-slide">
- <img src="upload/2.jpeg" alt="">
- <p>老师教你应对面试技巧p>
- div>
- <div class="swiper-slide">
- <img src="upload/3.jpeg" alt="">
- <p>老师教你应对面试技巧p>
- div>
- <div class="swiper-slide">
- <img src="upload/4.jpeg" alt="">
- <p>老师教你应对面试技巧p>
- div>
-
- div>
- div>
- <div class="swiper-button-next swiper-button-black">div>
- <div class="swiper-button-prev swiper-button-black">div>
-
- section>
- <section class="charge_learn">
- <div class="charge_learn_header">
- <span><img src="images/i1.png" alt="">充电学习span>
- <a href="#">更多>>a>
- div>
-
- <div class="swiper charge_learn_mySwiper">
- <div class="swiper-wrapper">
- <div class="swiper-slide">
- <img src="upload/pic1.png" alt="">
- <p>说地道英语,告别中式英语p>
- <p class="learn_people">156人学习p>
- div>
- <div class="swiper-slide">
- <img src="upload/pic2.png" alt="">
- <p>说地道英语,告别中式英语p>
- <p class="learn_people">156人学习p>
- div>
- <div class="swiper-slide">
- <img src="upload/pic1.png" alt="">
- <p>说地道英语,告别中式英语p>
- <p class="learn_people">156人学习p>
- div>
- div>
- div>
- section>
- <section class="footer">
- <div>
- <img src="images/home.png" alt="">
- <p>首页p>
- div>
- <div>
- <img src="images/ms.png" alt="">
- <p>模拟面试p>
- div>
- <div>
- <img src="images/net.png" alt="">
- <p>技术面试p>
- div>
- <div>
- <img src="images/user.png" alt="">
- <p>我的主页p>
- div>
- section>
-
- body>
- <script src="js/flexible.js">script>
-
- <script src="js/swiper/swiper-bundle.min.js">script>
- <script src="js/swiper/swiper.min.js">script>
- <script src="js/employment_guidance/rotate.js">script>
- <script src="js/employment_guidance/rotate_btn.js">script>
-
- <script src="js/charge_learn/rotate.js">script>
-
- <script src="js/index.js">script>
-
- html>
index.less
- @rate:37.5;
-
- // body {
- // height:3000px!important;
- // }
- // 头部的黑马面面
- .header {
- text-align: center;
- font-size: (20rem/@rate);
- margin-top: (20rem/@rate);;
- }
-
- // 导航区域(六个功能)
-
- .nav {
- margin-top: (30rem/@rate);
- display: flex;
- flex-wrap: wrap;
- height:(250rem/@rate);
- a {
- width:33.33333%;
- display:flex;
- flex-direction: column;
- align-items: center;
- span:nth-child(1) {
- width:(69.5rem/@rate);
- height:(69.5rem/@rate);
- background-repeat: no-repeat;
- background-size: (69.5rem/@rate) (69.5rem/@rate);
- }
- span:nth-child(2) {
- font-size:(14rem/@rate);
- }
- }
- a:nth-child(1) {
- span:nth-child(1) {
- background-image: url(../images/icon1.png);
- }
- }
-
- a:nth-child(2) {
- span:nth-child(1) {
- background-image: url(../images/icon2.png);
- }
- }
- a:nth-child(3) {
- span:nth-child(1) {
- background-image: url(../images/icon3.png);
- }
- }
- a:nth-child(4) {
- span:nth-child(1) {
- background-image: url(../images/icon4.png);
- }
- }
- a:nth-child(5) {
- span:nth-child(1) {
- background-image: url(../images/icon5.png);
- }
- }
- a:nth-child(6) {
- span:nth-child(1) {
- background-image: url(../images/icon6.png);
- }
- }
- }
-
- // 横幅区域(每日十练)
- .banner {
- width: 100%;
- height:(76rem/@rate);
- background-image: url(../upload/go.png);
- background-repeat: no-repeat;
- background-size: auto (76rem/@rate);
- background-position: center center;
- }
-
- // 就业指导头部
- .teach_work {
- position: relative;
- width:100%;
- height:(300rem/@rate);
- padding-left: (5rem/@rate);
- padding-right: (5rem/@rate);
- margin-top:(20rem/@rate);
- .teach_work_header {
- width: 100%;
- display: flex;
- justify-content: space-between;
- height: (19rem/@rate);
- line-height: (19rem/@rate);
- span {
- img {
- width:(19rem/@rate);
- height:(19rem/@rate);
- }
- font-size:(16rem/@rate);
- font-weight: bolder;
- }
- a {
- position:absolute;
- right:0px;
- padding-right: (5rem/@rate);
- font-size:(14rem/@rate);
- color: #888;
- }
- }
- }
-
- // 充电学习头部
- .charge_learn {
- position: relative;
- width:100%;
- height:(250rem/@rate);
- padding-left: (5rem/@rate);
- padding-right: (5rem/@rate);
- .charge_learn_header {
- width: 100%;
- display: flex;
- justify-content: space-between;
- height: (19rem/@rate);
- line-height: (19rem/@rate);
- span {
- img {
- width:(19rem/@rate);
- height:(19rem/@rate);
- }
- font-size:(16rem/@rate);
- font-weight: bolder;
- }
- a {
- position:absolute;
- right:0px;
- padding-right: (5rem/@rate);
- font-size:(14rem/@rate);
- color: #888;
- }
- }
- }
-
- // 尾部
- .footer {
- position: fixed;
- bottom:0px;
- width: 100%;
- height: (70rem/@rate);
- z-index: 999;
- display: flex;
- background-color: white;
- div {
- flex:1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- p {
- font-size: (14rem/@rate);
- margin-top: (5rem/@rate);
- }
- img {
- width: (25rem/@rate);
- height:(25rem/@rate)
-
- }
- }
- }
index.js中没有内容,没有做轮播图之外的交互动作
charge_learn中的rotate.less
- @rate: 37.5;
-
- .charge_learn {
- .swiper {
- width: 100%;
- height: 80%;
- }
-
- .swiper-slide {
- text-align: center;
- background: #fff;
-
- // width: (290rem/@rate);
- // height: (340rem/@rate);
-
- /* Center slide text vertically */
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- flex-direction: column;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- // -webkit-align-items: flex-start;
- // align-items: flex-start;
-
- -webkit-align-items: center;
- align-items: center;
-
- p {
- width: 85%;
- font-size:(14rem/@rate);
- text-align: left;
- margin-top:(5rem/@rate);
- }
-
- .learn_people {
- color: red;
- }
- }
-
- .swiper-slide img {
- display: block;
- width: (136rem/@rate);
- height: (85.5rem/@rate);
- object-fit: cover;
- }
- }
employment_guidance中的rotate.less
- @rate: 37.5;
-
- .teach_work {
- .swiper-container {
- width: 80%;
- height: 90%;
- }
-
- .swiper-slide {
- text-align: center;
- // font-size: 18px;
- background: #fff;
-
- /* Center slide text vertically */
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- flex-direction: column;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
- transition: 300ms;
- transform: scale(0.8);
-
- opacity: 0.5;
- // margin-left: -20px;
- // margin-right: -20px;
- }
-
- .swiper-slide-active,
- .swiper-slide-duplicate-active {
- transform: scale(1);
- z-index: 999;
-
- opacity: 1;
- }
-
-
- .swiper-slide img {
- display: block;
- width: (169rem/@rate);
- height: (188rem/@rate);
- }
-
-
- .swiper-slide p {
- font-size: (14rem/@rate);
- }
-
- .swiper-button-black:after {
- font-size: 25px;
- opacity: 0.7;
- // width:11px;
- // height:22px;
- }
- }
employment_guidance的按钮也有自带的一个样式,但那个与上面的rotate.css有的地方有冲突,有的地方没用,所以后面就删掉了,不影响使用
charge_learn中的rotate.js
- var swiper = new Swiper(".charge_learn_mySwiper", {
- slidesPerView: 2.4,
- // spaceBetween: 30,
- pagination: {
- el: ".swiper-pagination",
- clickable: true,
- },
- });
employment_guidance中的ratate.js
- var swiper = new Swiper('.swiper-container', {
- slidesPerView: 2,
- // spaceBetween: 30,
- centeredSlides: true,
- loop: true,
- pagination: {
- el: '.swiper-pagination',
- clickable: true,
- },
- });
employment_guidance中的ratate_btn.js
- var swiper = new Swiper(".teach_work_mySwiper", {
- slidesPerView: 2,
- // spaceBetween: 30,
- loop: true,
- centeredSlides: true,
- pagination: {
- el: ".swiper-pagination",
- clickable: true,
- },
- navigation: {
- nextEl: ".swiper-button-next",
- prevEl: ".swiper-button-prev",
- },
- });
以上就项目的基本内容,下面我提几点需要注意的地方
在视频的P471-P472 介绍了摹客的使用,这个平台可以方便开发人员对原型图进行测量,切图,并且可以生成局部的CSS代码,这个得需要正式版的PS,我这里没有,所以就不用了,感兴趣的朋友可以看一下
摹客官网 更好的产品设计协作平台 - 摹客
swiper是用于做轮播图的插件,官网地址 Swiper中文网-轮播图幻灯片js插件,H5页面前端开发
可以在官网的这里下载一些文件
你也可以不在这里下载,在线演示中有很多效果
找到你需要的轮播图样式-异性的slide,之后点击在新窗口打开
按下F12后可以发现html,css与js
现在得到了html,css与js,在html中引入css与js的正确路径
搞下来后,比如说你发现这个不知道是干什么用的
这个时候,在swiper的API文档可以查看API|
在这里搜索可以发现这个变量是什么,以及它的用法
在就业指导中,我们还需要两个按钮,找一找发现这个差不多
用同样的方法搞下来,再改一改,调一调,就能用了
charge_learn中的轮播图也是使用swiper提供的效果,使用的时候注意不要将两个轮播图给同一个类名
码云是gitee,你需要先搞一个账号 Gitee - 基于 Git 的代码托管和研发协作平台
登陆后新建一个仓库
输入名称后直接点击创建就可以了
创建之后会告诉你怎么传
安装完成后,在项目根目录下右键,点击Git Bash Here,如果不了解git可以看一下这个 git基本操作_Suyuoa的博客-CSDN博客
把gitee的全局设置提示粘进去就可以了
输入后会发现项目路径下多了一个.git
仓库地址在这里可以看到
我们输入这行命令
发布成功后会在gitee仓库中看到我们刚刚上传的文件
点击服务后,然后点击Gitee Pages
实名认证之后点击启动
启动成功后会得到一个网址
在连接互联网的状态下访问这个地址就可以访问我们的静态网页了