JQuery event.pageX / pageY incompatible in firefox / ie

While trying to convert some of my JS to cross browser compatibility, I ran into strange behavior where I can't pinpoint the problem.

I want to convert window.event.x (IE specific) using jQuery, so my code looks like this:

function someFunction(e){
   var ev = $.event.fix(e);
   alert(ev.pageX);
}

      

This returns the correct value in IE, however in FF it returns an eight digit number . Any hints?

+2


source to share


2 answers


Make sure you are using the most recent version of jQuery. The official site states that event.pageX and event.pageY are fixed for IE so you may not need to usefix();



+1


source


At least on my local XP VM, both Firefox and IE 8 return the same sane value for X / Y codes when using Javascript like this:

$('#some-big-div').click(function(e) {
  console.log("mouse coords: (" + e.pageX + ", " + e.pageY ")")
}

      



Perhaps the call in $ .event.fix () in your example is b0rking the FF output?

0


source







All Articles