0

問題は次のとおりです。次のような変換された 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';
}

これを修正するには?

4

1 に答える 1

0

次のようなパラメータを使用vxします。vy

$( 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
});
于 2013-08-20T12:16:20.043 に答える