得到鼠标的pageX pageY 得到黄框父元素的offsetLeft offsetTop
pageX-offsetLeft得到黄框内x的位置 pageY-offsetTop得到黄框内y的位置
黄框.style.left = x-黄框.offsetWidth / 2 +'px' 黄框.style.top = y-黄框.offsetWidth / 2 +'px'
if(黄框.style.left <0){黄框.style.left = 0} else if(黄框.style.left >黄框父元素.offsetWidth - 黄框.offsetWidth){黄框.style.left = 黄框父元素.offsetWidth - 黄框.offsetWidth + 'px'}
同理top
牙叔教程 简单易懂
群里有人问, 放大镜怎么写
Autojs版本: 9.0.5
Android版本: 8.0.0
软件可能还有些许bug, 介意就别看了, 百度找别的教程去
思路是最重要的, 其他的百度, bing, stackoverflow, 安卓文档, autojs文档, 最后才是群里问问
--- 牙叔教程
部分内容来自网络
本教程仅用于学习, 禁止用于其他用途