Toggle navigation
首页
热门资讯
资源下载
技术博客
会员
中心
会员中心
发布博文
发布资源
首页
文章中心
JavaScript
javascript 公用拖拽类代码
206 阅读
0 评论
136 点赞
我是
靠谱客
的博主
爱听歌棉花糖
,这篇文章主要介绍
javascript 公用拖拽类代码
,现在分享给大家,希望可以做个参考。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>D类</title> <style type="text/css"> html, body { margin:0; } </style> </head> <body> <div style="position:relative; width:100px; height:100px; background-color:#000000;"> <div style="position:absolute; width:20px; height:20px; line-height:20px; left:50%; top:50%; margin:-10px 0 0 -10px; background-color:#F00; text-align:center; cursor:move;" onmousedown="var wc = this;D.start(wc, null, function (property) { var node = wc.parentNode; var a = D.pos(node), b = D.pos(wc); node.style.left = property.left - b.x + a.x + 'px'; node.style.top = property.top - b.y + a.y + 'px'; }, null);" >拽</div> </div> <div style="width:50px; height:50px; line-height:50px; text-align:center; background-color:#F00; position:absolute; cursor:move;" onmousedown="var wc = this;D.start(wc, null, function (property) { wc.style.left = property.left + 'px'; wc.style.top = property.top + 'px'; }, null);" >拽</div> <div style="height:1000px;"></div> </body> </html>
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
最后
以上就是
爱听歌棉花糖
最近收集整理的关于
javascript 公用拖拽类代码
的全部内容,更多相关
javascript
内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(
136
)
本文分类:
JavaScript
浏览次数:
206
次浏览
发布日期:2022-04-09 06:12:01
本文链接:
https://www.kaopuke.com/article/k-p-k_12_u_7_okf5_14_j_10__27_.html
相关文章
JSP由浅入深(8)—— JSP Tags
自动刷新网页,自动刷新当前页面,JS调用
互联网工作门槛不高,要做好不容易
innerHTML与jquery里的html()区别介绍
javascript 公用拖拽类代码
PowerShell函数一次返回多个返回值示例
网站优化之如何挖掘优化长尾关键词
达尔优牧马人EM911Ⅲ游戏鼠标怎么样?
评论列表
共有
0
条评论
发表评论
取消回复
登录
注册新账号
立即
投稿
微信扫一扫:分享
微信里点“发现”,扫一下
二维码便可将本文分享至朋友圈。
返回
顶部
发表评论 取消回复