仿ofo单车做一个轮播效果
首先我是利用swiper.js做的,因为这个很强大,哈哈~~,上代码
html很简单
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="https://common.ofo.so/campaign/valentine/images/ditie4.png" alt="" class="swiper-item">
</div>
<div class="swiper-slide">
<img src="https://common.ofo.so/campaign/valentine/images/ditie3.png" alt="" class="swiper-item">
</div>
<div class="swiper-slide">
<img src="https://common.ofo.so/campaign/valentine/images/ditie2.png" alt="" class="swiper-item">
</div>
<div class="swiper-slide">
<img src="https://common.ofo.so/campaign/valentine/images/ditie1.png" alt="" class="swiper-item">
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
</div>
</body>
js
<script src="js/swiper.min.js"></script>
<script>
var swiper = new Swiper('.swiper-container', {
slidesPerView: 2, //每屏显示的个数
loopedSlides: 5, //一般与slidersPerView一起使用
centeredSlides: true,
spaceBetween: 30, //间隔距离
pagination: {
el: '.swiper-pagination',
clickable: true,
}
});
</script>
css部分
html, body {
position: relative;
height: 100%;
}
body {
background: #fff;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color:#000;
margin:;
padding:;
}
.swiper-container {
width: 100%;
height: 250px;
padding-top: 20px;
margin-top: 20px;
}
.swiper-slide {
position: relative;
top:;
text-align: center;
font-size: 18px;
background: #fff; /* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-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;
width: 60%;
height:100%;
}
.swiper-slide.swiper-slide-active{
-webkit-transform: scale(1.2);
transform: scale(1.2);
z-index:;
}
.swiper-slide.swiper-slide-prev,.swiper-slide.swiper-slide-next{
-webkit-transform: scale(0.8);
transform: scale(0.8);
}
.swiper-item{
width: 290px;
position: absolute;
top:;
left: 50%;
transform: translateX(-50%);
}
主要是改变css的样式
仿ofo单车做一个轮播效果的更多相关文章
- 用JQ去实现一个轮播效果
前提:用JQ去实现轮播效果一步步的做一个梳理. 首先肯定是轮播的HTML和CSS样式了: <body> <div class="pic"> <div ...
- 小程序或者vue,解决菜单导航做做成轮播的样子
案例: 其中最重要的思路就是如何让第二次或第三次以及后面的轮播有数据: 做法大致跟轮播图做法一样,只不过我们需要进行书写样式,代码如下: <!-- 做一个轮播图navbar demo --> ...
- 为什么使用bootstrap在一个页面同时做两个轮播效果时,只有第一个有效??
我们都知道使用bootstrap做轮播效果非常快,但是有时候一个页面会需要两个轮播:但这个时候再次使用bootstrap做轮播效果时就会失效:原因在于bootstrap的Carousel问题,只要修改 ...
- 使用jQuery做简单的图片轮播效果
一.本特效主要用到的前端知识点 CSS中绝对定位(absolute)CSS实现垂直居中jQuery中简单的淡入淡出动画效果(fadeIn,fadeOut)定时器(setInterval,clear ...
- 常见的仿Flash图片轮播效果
现在基本在很多网站上都能看到轮播效果,虽然有点烂大街的赶脚,但是这个效果确实很好看,很时尚,今天分享下代码相对较少的轮播框架,望采纳 . ①向左滑动: 思路: 将几个图片用分别用几个 li 包住,并且 ...
- css3关键帧动画实现轮播效果
实现效果:打开手机京东,可以看到首页的头部,以这个头部为基础,仿写一个类似的样式. 思路:仔细观察可以发现,手机京东的头部是以一个搜索栏和轮播特效组成的,而这个搜索栏是以轮播特效做为背景的,现在运用c ...
- js的轮播效果
图片的轮播效果!主要运用了元素的style样式属性,与 setInterval(); <!DOCTYPE html> <html> <head lang="en ...
- JS实现焦点图轮播效果
大家平时逛淘宝网的时候,在首页就能看到焦点图轮播的效果,就是这个样子的: PS:想起每每打开淘宝,总会被这个玩意先夺眼球,偶尔还去点进去溜溜,幸好我定力好,总能控制住自己的购买欲望,为自己不用剁手感到 ...
- jQuery实现轮播效果(一) - 基础
前戏: XXXX年XX月XX日,经理交给我一个站点新闻资讯网页开发的活儿.我一个java程序猿,怎么完毕得了网页设计这样高端的活儿呢! 之前尽管有学过一点HTML.CSS的知识.可是在实际的使用中,把 ...
随机推荐
- TensorFlow-GPU环境配置之一——安装Ubuntu双系统
本机已经安装过Windows系统,准备安装Ubuntu双系统进行TensorFlow相关工作,需要在windows中将磁盘分出一定空间供Ubuntu使用 1.首先下载Ubuntu17.04版本ISO ...
- Linux学习系列之Inotify+Rsync实现实时数据同步
Inotify简介 inotify介绍 inotify是一种强大的.异步的文件系统监控机制,linux内核从2.6.13起,加入了inotify的支持,通过inotify可以监控文件系统中添加.删除. ...
- shell脚本变量的参数
https://stackoverflow.com/questions/5163144/what-are-the-special-dollar-sign-shell-variables mkdir f ...
- pipenv 的使用
pipenv 的使用 学习了:https://blog.csdn.net/chroming/article/details/77104873?locationNum=4&fps=1 https ...
- java MAT 分析
java MAT 分析 http://blog.csdn.net/qeqeqe236/article/details/43577857 https://www.cnblogs.com/AloneSwo ...
- 配置文件的备份和IOS 的备份
分享到 QQ空间 新浪微博 百度搜藏 人人网 腾讯微博 开心网 腾讯朋友 百度空间 豆瓣网 搜狐微博 百度新首页 QQ收藏 和讯微博 我的淘宝 百度贴吧 更多... 百度分享 广场 登录 注册 关注此 ...
- 标准ACL、扩展ACL和命名ACL的配置详解
访问控制列表(ACL)是应用在路由器接口的指令列表(即规则).这些指令列表用来告诉路由器,那些数据包可以接受,那些数据包需要拒绝. 访问控制列表(ACL)的工作原理 ACL使用包过滤技术,在路由器上读 ...
- Linux Centos7 Apache 訪问 You don't have permission to access / on this server.
折腾了非常久,今天才找到了最正确的答案.感言真不easy. 百度出来的99%都是採集的内容.全都是错误的. You don't have permission to access / on this ...
- 为什么有些信号线串接33R小电阻?
本人只是刚入坑的硬件助理,一名小白,很多都知识不懂,以下信息多数来自网络,可能不准确,恳请批评指正! 正文: 参考资料:http://blog.csdn.net/xiangyuqxq/article/ ...
- 基于Canvas的Char.js库使用
Chart.js是基于Html5 Canvas的图表库. 官网:http://www.chartjs.org/ 參考文档:http://www.chartjs.org/docs/ 支持六种图表,相应源 ...