<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0" name="viewport"/>
<meta name="format-detection" content="telephone = no"/>
<title>手机上div元素拖动</title>
<style>
#indexbtn{
width:100px;
height:100px;
background-color:black;
position:fixed;
left: 10px;
top: 100px;
}
</style>
</head>
<body>
<div id="indexbtn"></div>
<script>
(function() {
/**
* 拖拽方法
* @param id 元素id
* @param options 可拖拽的位置top、right、bottom、left
* @constructor
*/
var Drag = function(id,options) {
//插入动画过渡
var style = document.createElement("style"
手机上div元素拖动
最新推荐文章于 2022-07-08 20:32:20 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)