-
Notifications
You must be signed in to change notification settings - Fork 0
/
canvas1.html
67 lines (57 loc) · 1.65 KB
/
canvas1.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
<html>
<head>
<title>Nav Canvas Example</title>
<link rel="stylesheet" href="stylesheets/canvas1.css" />
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
</head>
<body>
<div class="js" role="navigation">One</div>
<div class="js" role="main">
<ol id="placeholder"></ol>
Two<br />
<button id="navClick">Nav</button><br />
<button id="bodyClick">Body</button><br />
<button id="sidebarClick">Sidebar</button><br />
</div>
<div class="js" role="complementary">Three
<br />
<button id="bodyClick2">Return to Body</button>
</div>
<script type="text/javascript">
var btnNav = $("#navClick");
var btnBody = $("#bodyClick");
var btnSideBar = $("#sidebarClick");
var btnSideBody = $("#bodyClick2");
var placeholder = $("#placeholder");
var maxSize = 50;
function returnToBody() {
$("div[role]").each(function() {
//$(this).removeClass("js");
if ($(this).hasClass("active-nav"))
$(this).removeClass("active-nav");
if ($(this).hasClass("active-sidebar"))
$(this).removeClass("active-sidebar");
});
}
btnNav.click(function() {
$("div[role]").each(function() {
//$(this).removeClass("js");
$(this).addClass("active-nav");
});
});
btnBody.click(returnToBody);
btnSideBody.click(returnToBody);
btnSideBar.click(function() {
$("div[role]").each(function() {
//$(this).removeClass("js");
if ($(this).hasClass("active-nav"))
$(this).removeClass("active-nav");
$(this).addClass("active-sidebar");
});
});
for (var i = 0; i < 50; i++) {
placeholder.append("<li>Test</li>");
}
</script>
</body>
</html>