一、使用原生js實現拖拽點擊打開視頻講解更加詳細
<html lang="en"> <head> <meta charset="UTF-8" /> <title>Lazyload</title> <style> .drag { background-color: skyblue; position: absolute; line-height: 100px; text-align: center; width: 100px; height: 100px; } </style> </head> <body> <!-- left和top要寫在行內樣式里面 --> <div class="drag" style="left: 0; top: 0">按住拖動</div> <script src=https://www.huyubaike.com/biancheng/"./jquery-3.6.0.min.js">
