我在父母离婚(超支:汽车)中有两个分歧:两个差异很大,因此,我为父母领取薪金,问题是,当我上下台和下台时(有时甚至负价值),我如何计算 mo的相对价值时,我会为内部离婚获得可变的摩擦坐标。
jQuery(document).ready(function(){
$("#MnDiv").click(function(e){
var clientXRel = e.clientX - this.offsetLeft;
var clientYRel = e.clientY - this.offsetTop;
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
var clientCoordsRel = "( " + clientXRel + ", " + clientYRel + " )";
$("span:first").text("( e.clientX, e.clientY ) : " + clientCoords);
$("span:last").text("( clientXRel , clientYRel ) : " + clientCoordsRel
+ " ( offsetLeft , offsetTop ) : " + this.offsetLeft+ ", " this.offsetTop);
});
So the Question is How to get the right coordinates relative to the inside Div no matter where the scroll is? The complete Example(jsfiddle) Here
预 收