-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrolx2 - Copy.html
238 lines (222 loc) · 7.13 KB
/
controlx2 - Copy.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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://code.interactjs.io/v1.3.4/interact.min.js"></script>
<script>
// target elements with the "draggable" class
interact('.draggable')
.draggable({
// enable inertial throwing
inertia: true,
// keep the element within the area of it's parent
restrict: {
restriction: "parent",
endOnly: true,
elementRect: { top: 0, left: 0, bottom: 1, right: 1 }
},
// enable autoScroll
autoScroll: true,
// call this function on every dragmove event
onmove: dragMoveListener,
// call this function on every dragend event
onend: function (event) {
var textEl = event.target.querySelector('p');
}
});
function dragMoveListener (event) {
var target = event.target,
// keep the dragged position in the data-x/data-y attributes
x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
// translate the element
target.style.webkitTransform =
target.style.transform =
'translate(' + x + 'px, ' + y + 'px)';
// update the posiion attributes
target.setAttribute('data-x', x);
target.setAttribute('data-y', y);
}
// this is used later in the resizing and gesture demos
window.dragMoveListener = dragMoveListener;
$.change1 = function() {
if ($('#d3').width="25%"){
$('#d3').animate({width: "0%",height: "0%"});
}
if ($('#d2').width="25%"){
$('#d2').animate({width: "0%",height: "0%"});
}
if ($('container').width<="100%"){
$('container').animate({width: "100%",height: "100%"});
}
if ($('#d1').width=100){
$('#d1').animate({width: "1400px",height: "700px"});
}
};
$.change2 = function() {
if ($('#d1').width="25%"){
$('#d1').animate({width: "0%",height: "0%"});
}
if ($('#d3').width="25%"){
$('#d3').animate({width: "0%",height: "0%"});
}
if ($('container').width<="100%"){
$('container').animate({width: "100%",height: "100%"});
}
if ($('#d2').width=100){
$('#d2').animate({width: "1650px",height: "700px"});
}
};
$.change3 = function() {
if ($('#d1').width="25%"){
$('#d1').animate({width: "0%",height: "0%"});
}
if ($('#d2').width="25%"){
$('#d2').animate({width: "0%",height: "0%"});
}
if ($('container').width<="100%"){
$('container').animate({width: "100%",height: "100%"});
}
if ($('#d3').width=100){
$('#d3').animate({width: "1650px",height: "700px"});
}
};
$.changeback = function() {
$('container').animate({width: "100%",height: "100%"});
$('#d1').animate({width: "500px",height: "350px"});
$('#d2').animate({width: "500px",height: "350px"});
$('#d3').animate({width: "500px",height: "350px"});
$('#d1').attr("src","C:\Users\martlee2\Downloads\sample1.jpg");
$('#d2').attr("src","C:\Users\martlee2\Downloads\sample2.jpg");
$('#d3').attr("src","C:\Users\martlee2\Downloads\sample3.jpg");
};
function change1html() {
$.change1();
};
function change2html() {
$.change2();
};
function change3html() {
$.change3();
};
function changebackhtml() {
$.changeback();
};
</script>
<style>
.container {
display: grid;
grid-template-columns: 1fr 1fr;
}
.container > div {
flex: 1; /*grow*/
}
.container div{
position: relative;
width: 500px;
height: 360px;
background-color: black;
}
#d1{
background:transparent;
border-style: solid;
border-color:#20C20E;
font-size:large;
text-align:center;
line-height:150px;
user-select: none;
display : block;
width: "25%";
height: "25%";
margin: 5px auto;
}
#d2{
background:transparent;
border-style: solid;
border-color:#20C20E;
font-size:large;
text-align:center;
line-height:150px;
user-select: none;
display : block;
width: "25%";
height: "25%";
margin: 5px auto;
}
#d3{
background:transparent;
border-style: solid;
border-color:#20C20E;
font-size:large;
text-align:center;
line-height:150px;
user-select: none;
display : block;
width: "25%";
height: "25%";
margin: 5px auto;
}
</style>
<head>
<title>
webpage
</title>
<link rel="stylesheet" href="http://anijs.github.io/lib/anicollection/anicollection.css">
<link rel="stylesheet" href="magic.css">
</head>
<body style="background-color:black;text-align:center">
<script>
var ws = new WebSocket("ws://127.0.0.1:5679/"),
messages = document.createElement('ul');
var yValue2;
var currentvalue = 0;
var ycurrentwindow = "0"
ws.onmessage = function (event) {
var wholedata = event.data;
var res2 = wholedata;
yValue2 = res2;
if (yValue2 == 0 || yValue2 == "0"){
document.getElementById('d1').style.borderColor = "pink";
document.getElementById('d2').style.borderColor = "#20C20E";
document.getElementById('d3').style.borderColor = "#20C20E";
ycurrentwindow = yValue2;
}
if (yValue2 == 1 || yValue2 == "1"){
document.getElementById('d2').style.borderColor = "pink";
document.getElementById('d1').style.borderColor = "#20C20E";
document.getElementById('d3').style.borderColor = "#20C20E";
ycurrentwindow = yValue2;
}
if (yValue2 == 2 || yValue2 == "2"){
document.getElementById('d3').style.borderColor = "pink";
document.getElementById('d1').style.borderColor = "#20C20E";
document.getElementById('d2').style.borderColor = "#20C20E";
ycurrentwindow = yValue2;
}
if ((yValue2 == 100 || yValue2 == "100") && ycurrentwindow == "0"){
change1html();
}
if ((yValue2 == 100 || yValue2 == "100") && ycurrentwindow == "1"){
change2html();
}
if ((yValue2 == 100 || yValue2 == "100") && ycurrentwindow == "2"){
change3html();
}
if ((yValue2 == 99 || yValue2 == "99")){
changebackhtml();
}
};
document.body.appendChild(messages);
</script>
<div class="container" style="width:100%; height:90%">
<div id="d1" class="draggable">
<p><img src="C:\Users\martlee2\Downloads\sample1.jpg" style="width:100%; height:90%" onmouseover="change1html()"></a></p>
</div>
<div id="d2" class="draggable">
<p><img src="C:\Users\martlee2\Downloads\sample2.png" style="width:100%; height:90%" onmouseover="change2html()"></a></p>
</div>
<div id="d3" class="draggable">
<p><img src="C:\Users\martlee2\Downloads\sample3.jpg" style="width:100%; height:90%" onmouseover="changebackhtml()"></a></p>
</div>
<br style="clear: left;" />
</div>
</body>
</html>