3 Days Until Mario Steals Your Liver
This commit is contained in:
parent
20d268eb36
commit
8042fdb72a
|
@ -1,2 +1,3 @@
|
|||
# gui-recreation
|
||||
|
||||
Recreating popular images using [98.css](https://github.com/jdan/98.css), [XP.css](https://github.com/botoxp9arty/XP.css), and [7.css](https://github.com/khang-nd/7.css).
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>7.css example</title>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/7.css"/>
|
||||
<style>
|
||||
#mario {
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
#mario-header {
|
||||
cursor: move;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="window" id="mario">
|
||||
<div class="title-bar" id="mario-header">
|
||||
<div class="title-bar-text"></div>
|
||||
<div class="title-bar-controls">
|
||||
<button aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window-body">
|
||||
<div style="display: flex;">
|
||||
<img src="./warning.ico" alt="warning" height="36px">
|
||||
<img src="./mario.png" alt="mario head" width="80px" style="margin-top: 30px;">
|
||||
<p style="margin: auto 20px 35px 20px;">3 Days Until Mario Steals Your Liver</p>
|
||||
</div>
|
||||
<section class="field-row" style="justify-content: flex-end">
|
||||
<button>ok</button>
|
||||
<button>cancel</button>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Make the DIV element draggable:
|
||||
dragElement(document.getElementById("mario"));
|
||||
|
||||
function dragElement(elmnt) {
|
||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
if (document.getElementById(elmnt.id + "header")) {
|
||||
/* if present, the header is where you move the DIV from:*/
|
||||
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
|
||||
} else {
|
||||
/* otherwise, move the DIV from anywhere inside the DIV:*/
|
||||
elmnt.onmousedown = dragMouseDown;
|
||||
}
|
||||
|
||||
function dragMouseDown(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
// get the mouse cursor position at startup:
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
document.onmouseup = closeDragElement;
|
||||
// call a function whenever the cursor moves:
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
|
||||
function elementDrag(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
// calculate the new cursor position:
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
// set the element's new position:
|
||||
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
|
||||
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
||||
}
|
||||
|
||||
function closeDragElement() {
|
||||
/* stop moving when mouse button is released:*/
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in New Issue