javascript元素跟随鼠标在指定区域运动
原文: javascript元素跟随鼠标在指定区域运动 元素跟随鼠标在指定区域运动通常是用在商城图片的放大镜中,下面是完整的Demo: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>鼠标区域</title> <style type="text/css"> *{margin:0;padding:0;} .area{ width:400px; height:400px; margin:30px auto; background: #ccc; overflow: hidden; position: relative; } .hover{ border:1px dashed #000; width:100px; height:100px; background: rgba(0,0,0,0.25); position: absolute; display: none; cursor: move; } </style...