-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
201 lines (172 loc) · 6.35 KB
/
index.html
File metadata and controls
201 lines (172 loc) · 6.35 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<title>JavaScript/JQuery Lesson</title>
<body>
<div id="nav">
<div class="description">
<div class="color_descript">
<strong>Background Color Change</strong>
<br /><br />
<strong>How does it work?</strong><br>
The color changes every 2 seconds
<br /><br />
<strong>How does it really work?</strong><br>
<br />
There are 9 colors in an array. We use Javascript randomizer function to pick a number at random which is assigned to a color. Voila! We apply to the background-color of the body container.
<strong>Code</strong><br><br>
<code>
window.setTimeout( "setbackground()", 2000); // 5000 milliseconds delay
window.setTimeout( "setbackground()", 2000); // 5000 milliseconds delay
var index = Math.round(Math.random() * 9);
var ColorValue = "FFFFFF"; // default color - white (index = 0)
if(index == 1)
ColorValue = "FFCCCC"; //peach
if(index == 2)
ColorValue = "CCAFFF"; //violet
if(index == 3)
ColorValue = "A6BEFF"; //lt blue
if(index == 4)
ColorValue = "99FFFF"; //cyan
if(index == 5)
ColorValue = "D5CCBB"; //tan
if(index == 6)
ColorValue = "99FF99"; //lt green
if(index == 7)
ColorValue = "FFFF99"; //lt yellow
if(index == 8)
ColorValue = "FFCC99"; //lt orange
if(index == 9)
ColorValue = "CCCCCC"; //lt grey
document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
$("#nav, .description, .color_descript").fadeIn("slow");
$(".fuzz_descript").hide();
$(".delete_button_descript").hide();
$(".alert_descript").hide();
</code>
</div>
<div class="delete_button_descript">
<strong>Slide & Delete</strong>
<br /><br />
<strong>How does it work?</strong><br>
The button shakes and deletes.
<br /><br />
<strong>How does it really work?</strong><br>
<br />
We used the Jquery SlideUp function and voila! It deletes.
<strong>Code</strong><br><br>
<code>
$(this).slideUp();
</code>
</div>
<div class="alert_descript">
<strong>Alert Pop-up</strong>
<br /><br />
<strong>How does it work?</strong><br>
An alert pop-ups and says something!
<br /><br />
<strong>How does it really work?</strong><br>
<br />
It just does. It is really simple.
<strong>Code</strong><br><br>
<code>
alert('This is an alert! You can write it directly into your HTML code:)')
</code>
</div>
<div class="fuzz_descript">
<strong>Background Gif</strong>
<br /><br />
<strong>How does it work?</strong><br>
We are setting the background to be a Gif!
<br /><br />
<strong>How does it really work?</strong><br>
<br /><br />
We are setting a Gif to repeat x and y so it full the entire screen.<br>
<strong>Code</strong><br><br>
<code>
We loaded a div with a background image that is gify (noise!) then set it to 0.9 opacity and z-index of -1.
</code>
</div>
</div>
</div>
<div class="main">
<h1> Learn about JavaScript/JQuery </h1>
<div id="content">
<button class="alert_1">Backgound Gif</button>
<button class="alert_2">Background Color</button>
<button class="alert_4">Alert Pop-up</button>
<button class="alert_3">Slide & Delete Me!</button>
<button class="back" value="Reload Page" onclick=location.href="index.html">Back</button>
</div>
</div>
<div id="fuzz"></div>
</body>
<footer>Brought to you by <strong>Work in Progress</strong>
</footer>
</html>
<script>
$(document).ready(function() {
$(function(){
$('#nav').hover(function(){
$(this).animate({width:'400px'},500);
},function(){
$(this).animate({width:'35px'},500);
}).trigger('mouseleave');
});
//Adjust height of overlay to fill screen when page loads
$("#fuzz").css("height", $(document).height());
//When the link that triggers the message is clicked fade in overlay/msgbox
$(".alert_1").click(function(){
$("#fuzz").fadeIn();
$("#nav, .description, .fuzz_descript").fadeIn("slow");
$(".color_descript").hide();
$(".delete_button_descript").hide();
$(".alert_descript").hide();
});
$(".alert_2").click(function(){
window.setTimeout( "setbackground()", 2000); // 5000 milliseconds delay
var index = Math.round(Math.random() * 9);
var ColorValue = "FFFFFF"; // default color - white (index = 0)
if(index == 1)
ColorValue = "FFCCCC"; //peach
if(index == 2)
ColorValue = "CCAFFF"; //violet
if(index == 3)
ColorValue = "A6BEFF"; //lt blue
if(index == 4)
ColorValue = "99FFFF"; //cyan
if(index == 5)
ColorValue = "D5CCBB"; //tan
if(index == 6)
ColorValue = "99FF99"; //lt green
if(index == 7)
ColorValue = "FFFF99"; //lt yellow
if(index == 8)
ColorValue = "FFCC99"; //lt orange
if(index == 9)
ColorValue = "CCCCCC"; //lt grey
document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
$("#nav, .description, .color_descript").fadeIn("slow");
$(".fuzz_descript").hide();
$(".delete_button_descript").hide();
$(".alert_descript").hide();
});
$(".alert_3").click(function() {
$(this).slideUp();
$("#nav, .description, .delete_button_descript").fadeIn("slow");
$(".color_descript").hide();
$(".fuzz_descript").hide();
$(".alert_descript").hide();
});
$(".alert_4").click(function() {
alert( 'This is an alert! You can write it directly into your HTML code :)' )
$("#nav, .description, .alert_descript").fadeIn("slow");
$(".color_descript").hide();
$(".delete_button_descript").hide();
$(".fuzz_descript").hide();
});
});
</script>