拖拽功能,首先是需要 mousedown,mousemove,mouseup 这三个事件的,然后最主要的是怎么样计算 目标元素 随鼠标移动的坐标 。1. 在mousedown事件里,获取鼠标点击时的坐标:initPos.x | initPos.y 和 目标元素的坐标: $target.offset().left | $target.offset().top, 计算出 当时鼠标 相对 目标元素左上角的 坐标relPos.x = initPos.x - $target.offset().left , relPosy = initPos.y- $taget.offset().top。2. 在mous Read More
posted @ 2011-09-08 17:49 limanclear Views(1934) Comments(3) Diggs(0)