-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
29 lines (27 loc) · 925 Bytes
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ChangeColor</title>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
</head>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<body>
<div id="colorSwap" swapStatus="red"></div>
</body>
<script>
var socket = io.connect();
$("div#colorSwap").click(function(e) {
socket.emit("colorSwap", $(this).attr("swapStatus"), function() {
//$("div#colorSwap").css("background-color", "red");
});
});
socket.on("executeChange", function(status){
$("div#colorSwap").css("background-color", status);
$("div#colorSwap").attr("swapStatus", status);
});
</script>
</html>