Spaces:
Running
Running
Ian Renton
commited on
Commit
•
4edb0a8
1
Parent(s):
0c4c6dd
Only selected window should have a blue titlebar
Browse files- code.js +12 -6
- index.html +6 -6
- style.css +8 -3
code.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
//
|
2 |
-
function
|
3 |
$(element).show();
|
4 |
-
$(element).
|
5 |
}
|
6 |
|
7 |
$( function() {
|
@@ -18,12 +18,18 @@ $( function() {
|
|
18 |
(function() {
|
19 |
var highest = 100;
|
20 |
|
21 |
-
$.fn.
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
};
|
24 |
})();
|
25 |
$('.window').click(function() {
|
26 |
-
$(this).
|
27 |
});
|
28 |
|
29 |
// Icon single click
|
|
|
1 |
+
// New window: show and bring to top
|
2 |
+
function newWindow(element) {
|
3 |
$(element).show();
|
4 |
+
$(element).selectWindow();
|
5 |
}
|
6 |
|
7 |
$( function() {
|
|
|
18 |
(function() {
|
19 |
var highest = 100;
|
20 |
|
21 |
+
$.fn.selectWindow = function() {
|
22 |
+
// Make top
|
23 |
+
this.css('z-index', ++highest);
|
24 |
+
// Make this window selected and others not
|
25 |
+
this.addClass('selectedwindow');
|
26 |
+
$('.window').not(this).each(function(){
|
27 |
+
$(this).removeClass('selectedwindow');
|
28 |
+
});
|
29 |
};
|
30 |
})();
|
31 |
$('.window').click(function() {
|
32 |
+
$(this).selectWindow();
|
33 |
});
|
34 |
|
35 |
// Icon single click
|
index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
<div id="window1" class="window" style="position: absolute; top: 100px; left: 100px; width: 500px; height: 400px; z-index: 1">
|
15 |
<div class="windowheader">
|
16 |
<div class="windowclose"></div>
|
17 |
-
<div class="windowtitle">
|
18 |
</div>
|
19 |
<div class="windowinner">
|
20 |
<div class="fullwindowhtml">
|
@@ -35,22 +35,22 @@
|
|
35 |
</div>
|
36 |
</div>
|
37 |
|
38 |
-
<div id="window3" class="window" style="position: absolute; top: 400px; left: 400px; width: 500px; height: 300px; z-index: 3">
|
39 |
<div class="windowheader">
|
40 |
<div class="windowclose"></div>
|
41 |
-
<div class="windowtitle">
|
42 |
</div>
|
43 |
<div class="windowinner">
|
44 |
<div class="fullwindowicons">
|
45 |
-
<div class="icon" ondblclick="
|
46 |
<img src="icons/clock.png">
|
47 |
<p>Clock</p>
|
48 |
</div>
|
49 |
-
<div class="icon" ondblclick="
|
50 |
<img src="icons/dos.png">
|
51 |
<p>MS-DOS</p>
|
52 |
</div>
|
53 |
-
<div class="icon" ondblclick="
|
54 |
<img src="icons/doom.png">
|
55 |
<p>DOOM</p>
|
56 |
</div>
|
|
|
14 |
<div id="window1" class="window" style="position: absolute; top: 100px; left: 100px; width: 500px; height: 400px; z-index: 1">
|
15 |
<div class="windowheader">
|
16 |
<div class="windowclose"></div>
|
17 |
+
<div class="windowtitle">Introduction</div>
|
18 |
</div>
|
19 |
<div class="windowinner">
|
20 |
<div class="fullwindowhtml">
|
|
|
35 |
</div>
|
36 |
</div>
|
37 |
|
38 |
+
<div id="window3" class="window selectedwindow" style="position: absolute; top: 400px; left: 400px; width: 500px; height: 300px; z-index: 3">
|
39 |
<div class="windowheader">
|
40 |
<div class="windowclose"></div>
|
41 |
+
<div class="windowtitle">Program Manager</div>
|
42 |
</div>
|
43 |
<div class="windowinner">
|
44 |
<div class="fullwindowicons">
|
45 |
+
<div class="icon" ondblclick="newWindow('#clock')">
|
46 |
<img src="icons/clock.png">
|
47 |
<p>Clock</p>
|
48 |
</div>
|
49 |
+
<div class="icon" ondblclick="newWindow('#dosprompt')">
|
50 |
<img src="icons/dos.png">
|
51 |
<p>MS-DOS</p>
|
52 |
</div>
|
53 |
+
<div class="icon" ondblclick="newWindow('#doom')">
|
54 |
<img src="icons/doom.png">
|
55 |
<p>DOOM</p>
|
56 |
</div>
|
style.css
CHANGED
@@ -34,17 +34,22 @@ html, body {
|
|
34 |
}
|
35 |
|
36 |
.windowheader {
|
37 |
-
background-color:
|
|
|
38 |
border-bottom: 1px solid black;
|
39 |
font-size: 14px;
|
40 |
-
height: 20px;
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
.windowtitle {
|
44 |
padding: 2px;
|
45 |
line-height: 16px;
|
46 |
text-align: center;
|
47 |
-
color: white;
|
48 |
cursor: default;
|
49 |
}
|
50 |
|
|
|
34 |
}
|
35 |
|
36 |
.windowheader {
|
37 |
+
background-color: lightgrey;
|
38 |
+
color: black;
|
39 |
border-bottom: 1px solid black;
|
40 |
font-size: 14px;
|
41 |
+
height: 20px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.selectedwindow .windowheader {
|
45 |
+
background-color: darkblue;
|
46 |
+
color: white;
|
47 |
}
|
48 |
|
49 |
.windowtitle {
|
50 |
padding: 2px;
|
51 |
line-height: 16px;
|
52 |
text-align: center;
|
|
|
53 |
cursor: default;
|
54 |
}
|
55 |
|