-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest4.html
111 lines (95 loc) · 4.22 KB
/
test4.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<link rel="stylesheet" href="../js/smoothness.css">
<script type="text/javascript" src="area-notifier.js"></script>
<style>
.Init {
position: absolute;
left: 500px;
top: 150px;
display: block;
text-align: center;
border: 1px solid;
width: 100px;
height: 50px;
}
.Info {
position: absolute;
left 100px;
top: 50px;
display: block;
}
input {
display: block;
}
.placeholder {
background: green;
position: absolute;
left: 900px;
top: 300px;
}
</style>
<script>
function actualizarPosiciones(e){
$("#xpos").val(e.offset().top);
$("#ypos").val(e.offset().left);
};
function iluminarZona(elemento) {
elemento.addClass("placeholder");
}
function apagarZona(elemento) {
elemento.removeClass("placeholder");
}
</script>
</head>
<body>
<div class="Info"></div>
<div class="row buttons">
<input type="button" value="getPos" onclick=actualizarPosiciones($("#Init"));>
</div>
<div id="container"></div>
<script>
/*
$(".Info").append($("<label>").prop('for','xpos').text('X position'));
$(".Info").append($("<input>").prop('type','text').attr('id','xpos'));
$(".Info").append($("<label>").prop('for','ypos').text('Y position'));
$(".Info").append($("<input>").prop('type','text').attr('id','ypos'));
$(".Info").append($("<label>").prop('for','inside').text('InsideObject'));
$(".Info").append($("<input>").prop('type','text').attr('id','inside'));
$(".Info").append($("<label>").prop('for','mouseX').text('Mouse position: X'));
$(".Info").append($("<input>").prop('type','text').attr('id','mouseX'));
$(".Info").append($("<label>").prop('for','mouseY').text('Mouse position: Y'));
$(".Info").append($("<input>").prop('type','text').attr('id','mouseY'));
$(".Info").append($("<label>").prop('for','up').text('Arriba'));
$(".Info").append($("<input>").prop('type','text').attr('id','up'));
$(".Info").append($("<label>").prop('for','down').text('Abajo'));
$(".Info").append($("<input>").prop('type','text').attr('id','down'));
$(".Info").append($("<label>").prop('for','left').text('Izquierda'));
$(".Info").append($("<input>").prop('type','text').attr('id','left'));
$(".Info").append($("<label>").prop('for','right').text('Derecha'));
$(".Info").append($("<input>").prop('type','text').attr('id','right'));
*/
$("#container").append($("<div>").prop('id','Init').prop('class','Init').text('Start'));
$("#container").append($("<div>").prop('id','Task').prop('class','Init').text('Task').css('top',240));
miArea = new Area({ element: $("#Init"), wide: 20});
miArea2 = new Area({ element: $("#Task"), wide: 20});
ph = $("<div>");
ph.addClass('placeholder');
$(document).bind('areaInvaded',function(event,data){
console.log(data.getInvaded());
ph.css('top',data.getAreaInvaded().position.top);
ph.css('left',data.getAreaInvaded().position.left);
ph.css('width',data.getAreaInvaded().width);
ph.css('height',data.getAreaInvaded().height);
$("#container").append(ph);
});
$(document).bind('areaReleased',function(event,data){
console.log('Outside!');
});
</script>
</body>
</html>