1 <!DOCTYPE html>
2 <html lang="zh">
3 <head>
4 <meta charset="UTF-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>拖动</title>
8 <style>
9 #mydiv {
10 width: 200px;
11 height: 200px;
12 background-color: blue;
13 }
14 </style>
15 </head>
16 <body>
17 <!-- 拖放的实现
18 1. 传统的拖放是根据鼠标按下,松开事件完成的;
19 2. HTML5对于拖放只需要在元素上面设置draggable="true"属性
20 <div class="mydiv" draggable="true"></div>
21 -->
22
23 <div id="mydiv" draggable="true"></div>
24 </body>
25 </html>