2013-08-20 73 views
0

问题是: 从来就转化DIV这样的:组的div鼠标坐标

$('#container').css('-moz-transform-origin', '0 0'); 
$('#container').css('-webkit-transform-origin', '0 0'); 
$('#container').css('-o-transform-origin', '0 0'); 
$('#container').css('-ms-transform-origin', '0 0'); 
$('#container').css('-transform-origin', '0 0'); 

$('#container').css('-moz-transform', 'scale(.5)'); 
$('#container').css('-webkit-transform', 'scale(.5)'); 
$('#container').css('-o-transform', 'scale(.5)'); 
$('#container').css('-ms-transform', 'scale(.5)'); 

现在我追加另一div来此缩放容器...

id('container').appendChild(follower);  

如果我知道想要设置此div完全符合文档的鼠标位置... 追随者的位置与文档鼠标位置极为不同

$(document).mousemove(function(e) { 

var IE = document.all ? true : false; 

if (IE) { 
    vx = e.clientX; 
    vy = e.clientY;  
} else { 
    vx = e.pageX; 
    vy = e.pageY; 
} 

follower.style.left = xDropPos + 'px'; 
follower.style.top = yDropPos + 'px'; 
} 

如何解决这个问题?

+0

后http://jsfiddle.net –

+0

here's问题作为的jsfiddle jsfiddle.net/__pwd__/9fVKH – user2663803

回答

0

使用vxvy参数一样,

$(document).mousemove(function(e) { 
    var IE = document.all ? true : false; 
    if (IE) { 
     vx = e.clientX; 
     vy = e.clientY;  
    } else { 
     vx = e.pageX; 
     vy = e.pageY; 
    } 
    follower.style.left = vx + 'px';// use vx 
    follower.style.top = vy + 'px';// use vy 
}); 
+0

...但还是加入了VX时* scale和vy *将div放大到另一个位置 – user2663803

+0

这里的问题在于jsfiddle http://jsfiddle.net/__pwd__/9fVKH/ – user2663803

+0

如果将鼠标移动到重新缩放的方块上并且想要设置红色方块到鼠标坐标 - 它失败... http://jsfiddle.net/__pwd__/9fVKH/ – user2663803