4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
9 <title>Flash Topmost Check Example/Test
</title>
12 <style type=
"text/css">
17 background-color: #cccccc;
27 background-color: #ffff00;
37 background-color: #00ffff;
47 background-color: #000000;
59 <script type=
"text/javascript">
60 var dragInfo
= { lastX
:0, lastY
:0, target
:null };
62 function onMouseDown(event
) {
63 dragInfo
.lastX
= event
.clientX
;
64 dragInfo
.lastY
= event
.clientY
;
65 dragInfo
.target
= event
.target
;
66 document
.addEventListener("mousemove", onMouseMove
, true);
67 document
.addEventListener("mouseup", onMouseUp
, true);
68 event
.preventDefault();
71 function onMouseMove(event
) {
72 deltaX
= event
.clientX
- dragInfo
.lastX
;
73 deltaY
= event
.clientY
- dragInfo
.lastY
;
74 dragInfo
.lastX
= event
.clientX
;
75 dragInfo
.lastY
= event
.clientY
;
76 baseX
= parseInt(dragInfo
.target
.style
.left
, 10);
77 baseY
= parseInt(dragInfo
.target
.style
.top
, 10);
78 dragInfo
.target
.style
.left
= (baseX
+ deltaX
) + "px";
79 dragInfo
.target
.style
.top
= (baseY
+ deltaY
) + "px";
80 event
.preventDefault();
83 function onMouseUp(event
) {
84 document
.removeEventListener("mousemove", onMouseMove
, true);
85 document
.removeEventListener("mouseup", onMouseUp
, true);
86 event
.preventDefault();
90 <div id=
"box0" style=
"left:0px;top:0px;"
91 onmousedown=
"onMouseDown(event)">Box #
0</div>
92 <div id=
"box1" style=
"left:100px;top:400px;"
93 onmousedown=
"onMouseDown(event)">Box #
1</div>
94 <embed id=
"plugin" type=
"application/x-ppapi-example-flash-topmost"
95 width=
"400" height=
"400"
96 style=
"left:200px;top:400px;" />
97 <div id=
"box2" style=
"left:200px;top:500px;"
98 onmousedown=
"onMouseDown(event)">Box #
2</div>
99 <div id=
"box3" style=
"left:0px;top:0px;"
100 onmousedown=
"onMouseDown(event)">Box #
3</div>