-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
119 lines (100 loc) · 2.49 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Menu Off-Canvas</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.3.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
font-family: Arial;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#wrapper {
position: relative;
overflow: hidden;
width: 100%;
height: 1000px;
}
#main {
width: 100%;
height: 100%;
position: relative;
-webkit-transform: translateX(0);
transform: translateX(0);
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
-webkit-transition: 300ms ease all;
-transition: 300ms ease all;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
padding: 3% 6%;
}
.show-nav #main {
-webkit-transform: translateX(300px);
transform: translateX(300px);
-webkit-transform: translate3d(300px,0,0);
transform: translate3d(300px,0,0);
}
#nav {
width: 300px;
height: 100%;
position: absolute;
top: 0;
left: -300px;
background: #438bca;
padding: 25px;
color: #fff;
}
.btn-close {
color: #fff;
font-size: 25px;
border: 2px solid #fff;
padding: 1px 11px 4px 10px;
width: 38px;
margin-bottom: 20px;
display: block;
border-radius: 50px;
text-decoration: none;
}
</style>
</head>
<body>
<article id="wrapper">
<section id="main">
<nav id="nav">
<a href="#" class="toggle-nav btn-close">x</a>
<h2>Menu Principal</h2>
<p>Você pode inserir uma lista de links nesta área.</p>
</nav>
<section id="content">
<a href="#" class="toggle-nav btn-nav">Menu </a>
<p>Todo o conteúdo permanece nesta área</p>
</section>
</section>
</article>
<script>
$(function(){
$('.toggle-nav').click(function (e) {
e.stopPropagation();
toggleNav();
});
$('#main').click(function (e){
var target = $(e.target);
if(!target.closest('#nav').length && $('#wrapper').hasClass('show-nav')) toggleNav();
});
function toggleNav(){
if($('#wrapper').hasClass('show-nav')){
$('#wrapper').removeClass('show-nav');
}
else {
$('#wrapper').addClass('show-nav');
}
}
});
</script>
</body>
</html>