<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Swiper demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <!-- Link Swiper's CSS -->
<link rel="stylesheet" href="../dist/css/swiper.min.css"> <!-- Demo styles -->
<style>
html, body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper-container {
width: 100%;
height: 100%;
}
.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;
-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;
}
.menu {
min-width: 100px;
width: 70%;
max-width: 320px; background-color: #2C8DFB;
color: #fff;
}
.content {
width: 100%;
} .menu-button {
position: absolute;
top: 0px; left: 0px; padding: 15px; cursor: pointer; -webkit-transition: .3s;
transition: .3s; background-color: #2C8DFB; /*margin: 14px;
border-radius: 5px;*/
}
.menu-button .bar:nth-of-type(1) {
margin-top: 0px;
}
.menu-button .bar:nth-of-type(3) {
margin-bottom: 0px;
} .bar {
position: relative;
display: block; width: 50px;
height: 5px; margin: 10px auto;
background-color: #fff; border-radius: 10px; -webkit-transition: .3s;
transition: .3s;
} .menu-button:hover .bar:nth-of-type(1) {
-webkit-transform: translateY(1.5px) rotate(-4.5deg);
-ms-transform: translateY(1.5px) rotate(-4.5deg);
transform: translateY(1.5px) rotate(-4.5deg);
}
.menu-button:hover .bar:nth-of-type(2) {
opacity: .9;
}
.menu-button:hover .bar:nth-of-type(3) {
-webkit-transform: translateY(-1.5px) rotate(4.5deg);
-ms-transform: translateY(-1.5px) rotate(4.5deg);
transform: translateY(-1.5px) rotate(4.5deg);
} .cross .bar:nth-of-type(1) {
-webkit-transform: translateY(15px) rotate(-45deg);
-ms-transform: translateY(15px) rotate(-45deg);
transform: translateY(15px) rotate(-45deg);
}
.cross .bar:nth-of-type(2) {
opacity: 0;
}
.cross .bar:nth-of-type(3) {
-webkit-transform: translateY(-15px) rotate(45deg);
-ms-transform: translateY(-15px) rotate(45deg);
transform: translateY(-15px) rotate(45deg);
}
.cross:hover .bar:nth-of-type(1) {
-webkit-transform: translateY(13.5px) rotate(-40.5deg);
-ms-transform: translateY(13.5px) rotate(-40.5deg);
transform: translateY(13.5px) rotate(-40.5deg);
}
.cross:hover .bar:nth-of-type(2) {
opacity: .1;
}
.cross:hover .bar:nth-of-type(3) {
-webkit-transform: translateY(-13.5px) rotate(40.5deg);
-ms-transform: translateY(-13.5px) rotate(40.5deg);
transform: translateY(-13.5px) rotate(40.5deg);
}
</style>
</head>
<body>
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide menu">Menu slide</div>
<div class="swiper-slide content">
<div class="menu-button">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
Content slide
</div>
</div>
</div> <!-- Swiper JS -->
<script src="../dist/js/swiper.min.js"></script> <!-- Initialize Swiper -->
<script>
var toggleMenu = function(){
if (swiper.previousIndex == 0)
swiper.slidePrev()
}
, menuButton = document.getElementsByClassName('menu-button')[0]
, swiper = new Swiper('.swiper-container', {
slidesPerView: 'auto'
, initialSlide: 1
, resistanceRatio: .00000000000001
, onSlideChangeStart: function(slider) {
if (slider.activeIndex == 0) {
menuButton.classList.add('cross')
menuButton.removeEventListener('click', toggleMenu, false)
} else
menuButton.classList.remove('cross')
}
, onSlideChangeEnd: function(slider) {
if (slider.activeIndex == 0)
menuButton.removeEventListener('click', toggleMenu, false)
else
menuButton.addEventListener('click', toggleMenu, false)
}
, slideToClickedSlide: true
})
</script>
</body>
</html>

最新文章

  1. Hawk使用补充说明
  2. java并发:线程同步机制之Lock
  3. thinkPhp 3.1.3的验证码无法显示的问题
  4. Summary of java stream classes
  5. [转载] Python的GIL是什么鬼,多线程性能究竟如何
  6. bzoj 2132: 圈地计划
  7. 右键菜单添加程序,指定图标, Notepad2、Sublime Text 2
  8. wall 和panel有啥区别
  9. create user &#39;root&#39;@&#39;localhost&#39; identified by 。。。
  10. 关于使用STL常见的两个bug
  11. 【转】AC算法详解
  12. 【BZOJ3238】差异(后缀自动机)
  13. java之集合Collection 3个例子
  14. Dynamics 365的系统作业实体记录增长太快怎么回事?
  15. 2073: [POI2004]PRZ
  16. push问题1
  17. js实现双向链表, 双向链表需要增加一个previous属性
  18. UVA-1623 Enter The Dragon (贪心)
  19. Ceph介绍
  20. java — 线程池

热门文章

  1. java动态返回一个大对象里多个小对象map返回,el表达式用c:set拼接
  2. php 多维数组相同键值处理合并
  3. iOS-delegate设计模式
  4. 吴恩达DeepLearning 第一课第四周随笔
  5. [Bzoj2282]消防(二分答案+树的直径)
  6. LayoutInflater.Factory 妙用
  7. 新工具填补Docker管理空白
  8. python学习笔记十二:类的定义
  9. ajax向Asp.NET后端传递数组型数据
  10. JS 如何获取radio或者checkbox选中后的值