/
mouseEvent.html
47 lines (34 loc) · 920 Bytes
/
mouseEvent.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
<!DOCTYPE html>
<html>
<head>
<title>RxJS</title>
<script src="rx.all.js" type="text/javascript"></script>
</head>
<body style="overflow:hidden;">
<div id="container" style="overflow:hidden;" >
</div>
<script type="text/javascript">
// function tester()
// {
var mouseMove = Rx.Observable.fromEvent(document, "mousemove" );
var text = "Sir Syed University of Engineering & Technology(by Zohaib Saleem) ";
var container = document.getElementById("container");
for(var i=0; i < text.length; i++)
{
(function(i)
{
var s = document.createElement("span");
s.innerHTML = text.charAt(i);
s.style.position = "absolute";
container.appendChild(s);
mouseMove.delay(i * 25).subscribe(function(mouseEvent)
{
s.style.top = mouseEvent.clientY + "px";
s.style.left = mouseEvent.clientX + i * 10 + 15 + "px";
});
}) (i);
}
//}
</script>
</body>
</html>