참고소스 수정본
This commit is contained in:
57
참고/playwright-main/tests/assets/drag-n-drop.html
Normal file
57
참고/playwright-main/tests/assets/drag-n-drop.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body, html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
div:not(.mouse-helper) {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#source {
|
||||
color: blue;
|
||||
border: 1px solid black;
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
top: 20px;
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
}
|
||||
#target {
|
||||
border: 1px solid black;
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
top: 200px;
|
||||
width: 400px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
function dragstart_handler(ev) {
|
||||
ev.currentTarget.style.border = "dashed";
|
||||
ev.dataTransfer.setData("text/plain", ev.target.id);
|
||||
}
|
||||
|
||||
function dragover_handler(ev) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
function drop_handler(ev) {
|
||||
console.log("Drop");
|
||||
ev.preventDefault();
|
||||
var data = ev.dataTransfer.getData("text");
|
||||
ev.target.appendChild(document.getElementById(data));
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<p id="source" ondragstart="dragstart_handler(event);" draggable="true">
|
||||
Select this element, drag it to the Drop Zone and then release the selection to move the element.</p>
|
||||
</div>
|
||||
<div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">Drop Zone</div>
|
||||
</body>
|
||||
Reference in New Issue
Block a user