<!DOCTYPE>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>CSS3侧滑导航</title>
	<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
	<style type="text/css">
	*{padding: 0;margin: 0;}
		nav{
			width: 100%;
			height: 50px;
			background-color: rgba(26,188, 156, 0.75);
			position: relative;
		}
		div{
			position: absolute;
			height: 100%;
			width: 50px;
			left: 20px;
			cursor: pointer;
			-webkit-transition: transform 1s;
			-moz-transition: transform 1s;
			-ms-transition: transform 1s;
			-o-transition: transform 1s;
			transition: transform 1s;
		}
		#hide,#show{
			display: block;
			height: 3px;
			background-color: #FFF;
			position: absolute;
			top: 50%;
			-webkit-transition: opacity .5s;
			-moz-transition: opacity .5s;
			-ms-transition: opacity .5s;
			-o-transition: opacity .5s;
			transition: opacity .5s;
		}
		#show{
			width: 20px;
			left: 15px;
			opacity: 0;
		}
		#hide{
			width: 30px;
			left: 10px;
			margin-top: -1.5px;
		}
		#hide::before,#hide::after,#show::before,#show::after{
			content: "";
			display: block;
			height: 3px;
			background-color: #FFF;
			position: absolute;
		}
		#hide::before,#hide::after{
			width: 30px;
		}
		#show::before,#show::after{
			width: 25px;
		}
		#hide::before,#show::before{
			top: -10px;
		}
		#hide::after,#show::after{
			top: 10px;
		}
		#show::before{
			 -webkit-transform: rotate(35deg) translateX(5px);
			 -moz-transform: rotate(35deg) translateX(5px);
			 -ms-transform: rotate(35deg) translateX(5px);
			 -o-transform: rotate(35deg) translateX(5px);
			 transform: rotate(35deg) translateX(5px);
		}
		#show::after{
			  -webkit-transform: rotate(-35deg) translateX(5px);
			 -moz-transform: rotate(-35deg) translateX(5px);
			 -ms-transform: rotate(-35deg) translateX(5px);
			 -o-transform: rotate(-35deg) translateX(5px);
			 transform: rotate(-35deg) translateX(5px);
		}
		ul{
			list-style: none;
			background-color: #455552;
			position: absolute;
			top: 50px;
			left: -200px;
			width: 74px;
			-webkit-transition: all .5s ease-in-out;
			-moz-transition: all .5s ease-in-out;
			-ms-transition: all .5s ease-in-out;
			-o-transition: all .5s ease-in-out;
			transition: all .5s ease-in-out;
		}
		li{
			margin: 0;
			padding: 0;
			position: relative;
			text-align: center;
		}
		a{
			text-decoration: none;
			color:#FFF;
			display: inline-block;
			height: 40px;
			line-height: 40px;
		}
		li:hover{
			background-color: rgba(26,188, 156, 0.75);
		}
	</style>
</head>
<body>
	<nav>
		<div id="toggleMenu">
			<span id="hide"></span>
			<span id="show"></span>
		</div>
		<ul id="list">
			<li>
				<a href="#">首页</a>
			</li>
			<li>
				<a href="#">问题</a>
			</li>
			<li>
				<a href="#">文章</a>
			</li>
			<li>
				<a href="#">关注</a>
			</li>
			<li>
				<a href="#">发现</a>
			</li>
		</ul>
	</nav>
	<script type="text/javascript">
		var toggle = document.getElementById("toggleMenu");
		var list = document.getElementById("list");
		var hide = document.getElementById("hide");
		var show = document.getElementById("show");
		var isHidden = true;

		window.onload = function() {
			toggle.onclick=function(){
				if(isHidden){
					list.style.left="0px";
					isHidden = false;
					hide.style.opacity=0;
					this.style.mozTransform = "rotate(180deg)";
					this.style.msTransform = "rotate(180deg)";
					this.style.oTransform = "rotate(180deg)";
					this.style.webkitTransform = "rotate(180deg)";
					this.style.transform = "rotate(180deg)";
					show.style.opacity=1;
				}else{
					list.style.left="-200px";
					isHidden = true;
					hide.style.opacity=1;
					this.style.mozTransform = "rotate(0deg)";
					this.style.msTransform = "rotate(0deg)";
					this.style.oTransform = "rotate(0deg)";
					this.style.webkitTransform = "rotate(0deg)";
					this.style.transform = "rotate(0deg)";
					show.style.opacity=0;
				}
			}
		}
	</script>
</body>
</html>

  

CSS3侧滑导航的更多相关文章

  1. css3动画导航实现

    代码 <!DOCTYPE html> <!-- saved from url=(0223)file:///C:/Users/user/AppData/Local/Temp/HZ$D. ...

  2. Android之侧滑导航栏

    今天学习的新内容是侧滑导航栏,我想大家肯定都比较熟悉了,因为这个效果在qq里面也有,最近一直跟室友们玩的游戏是快速让自己的头像的点赞量上千.当然我的效果跟qq是没有办法比的,因为那里面的功能是在是太强 ...

  3. Android 使用Toolbar+DrawerLayout快速实现仿“知乎APP”侧滑导航效果

    在以前,做策划导航的时候,最常用的组件便是SlidingMenu了,当初第一次用它的时候觉得那个惊艳啊,体验可以说是非常棒. 后来,Android自己推出了一个可以实现策划导航的组件DrawerLay ...

  4. 如何用CSS和jQuery实现一个侧滑导航菜单

    为了建立导航菜单,让我们先看看html结构:<!DOCTYPE html><html lang="en"><head> <meta cha ...

  5. 使用CSS3制作导航条和毛玻璃效果

    导航条对于每一个Web前端攻城狮来说并不陌生,但是毛玻璃可能会相对陌生一些.简单的说,毛玻璃其实就是让图片或者背景使用相应的方法进行模糊处理.这种效果对用户来说是十分具有视觉冲击力的. 本次分享的主题 ...

  6. css3制作导航栏

    <!doctype html><html lang="en"><head>    <meta charset="UTF-8&qu ...

  7. 分针网—IT教育:使用CSS3制作导航条和毛玻璃效果

    导航条对于每一个Web前端攻城狮来说并不陌生,但是毛玻璃可能会相对陌生一些.简单的说,毛玻璃其实就是让图片或者背景使用相应的方法进行模糊处理.这种效果对用户来说是十分具有视觉冲击力的.本次分享的主题: ...

  8. NavigationViewDemo【和DrawerLayout搭配使用实现侧滑导航视图界面】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 主要记录NavigationView的使用,而一般情况下NavigationView是和DrawerLayout搭配使用的,还有To ...

  9. jQuery+css3侧边栏导航菜单

    效果体验:http://hovertree.com/texiao/jquery/37/ 代码如下: <!doctype html> <html lang="zh" ...

随机推荐

  1. BNUOJ 34990 Justice String

    Justice String Time Limit: 2000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java cla ...

  2. C#串口调试工具 (WPF/MVVM结构完整示例版)

    前文 由于经常用到串口调试, 尽管有现成的软件, 因为前端时间涉及一个二次开发, 就因为一个RtsEnable设置, 折腾半天,  网上各种版本的也很多, 功能扩展的很开也多.所以现在自己做了一个够用 ...

  3. enterprise architect (EA) 源码生成UML类图,帮助理解项目工程

    用VS看大型工程代码,尤其是很多层类的,很容易头晕,即便是装了visual assist 插件.用VS生成类图吧,只能生成一堆框,只有一些小的类关系有箭头表示.远远不能满足要求.下面介绍建模工具EA来 ...

  4. Codeforces Round #249 (Div. 2) (模拟)

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. POJ --3045--Cow Acrobats(贪心模拟)

    Cow Acrobats Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit ...

  6. BZOJ 4448 主席树+树链剖分(在线)

    为什么题解都是离线的-- (抄都没法抄) 搞一棵主席树 1 操作 新树上的当前节点设成1 2 操作 查max(i-xx-1,0)那棵树上这条路径上有多少个点是1 让你找经过了多少个点 查的时候用dee ...

  7. jqueryValidator自定义校验规则的一种方式(不覆盖源码)

    1.封装自定义验证方法-validate-methods.js /***************************************************************** j ...

  8. 08:Challenge 1

    总时间限制:  10000ms 单个测试点时间限制:  1000ms 内存限制:  262144kB 描述 给一个长为N的数列,有M次操作,每次操作是以下两种之一: (1)修改数列中的一个数 (2)求 ...

  9. 基于JavaSwing的例子-非连接数据库

    项目结构: Constant.java package com.mstf.test; import java.io.Serializable; public class Constant implem ...

  10. Java中将String转json对象

    import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple. ...