I don't know if this is the right place to post this, but I noticed there is no compatibility helper in Ext.lib.Dom for window.screenX/window.screenY vs window.screenLeft/window.screenTop
I've only tried it in IE6/7 and FF2, but according to the 5th ed of the JavaScript rhino book, it says:
IE, Safari, and Opera support screenLeft and screenTop, while Firefox and Safari support screenX and screenY
I see I could just go:
x = window.screenLeft window.screenX
or something, but having a helper would save people (me) from having to hunt around and figure out what exactly is going on.
/util/trunk/doh/robot/DOHRobot.java â “ dojo â “ Trac:: 46, // compatibility. 47, private static HashMap charMap = null; .. 317, // not screenX/Y of the window; really screenLeft/Top in IE, but not all. 318, // browsers have this Note: See TracBrowser for help on using the browser. http://bugs.dojotoolkit.org/browser/util/trunk/doh/robot/DOHRobot.java?rev=20705HOME |
What do you think?
Fair enough :">. I thought there was a slight chance of appropriateness because it was more a suggestion for enhancement rather than a request for help.
I'm pretty sure there's nothing in Ext.Element that will get you the window position relative to the screen. I grepped for screenX and screenLeft in all of ext but there were none to be found.
For anyone who sees this who is thinking about using window.screenX/window.screenLeft to position a popup, just know you have to check both properties. JavaScript:: File Format: PDF/Adobe Acrobatwiederum, wie beispielsweise die Objekte window, document oder location, .. userAgent enthält die Zeichenkette compatible (typisch für Internet Explorer). screenX numerisch NN4: Abstand vom linken Bildschirmrand in _Pixeln screenLeft. JS 1.2 x-Koordinate der linken oberen Ecke des Fensters, http://digilib.happy-security.de/files/JavaScript-komplett.pdfHOME | JavaScript Programmer's Reference:: May 25, 2009 Browser version compatibility Browser upgrades are not always screenX The X coordinate of the window within the screen display. http://www.real-world-systems.com/docs/javascript.htmlHOME |
Also note the Y value in FF is the top of the window, whereas in IE the Y value is the top of the viewport.
My code is
var top = window.screenTop != undefined ? window.screenTop : window.screenY;
var left = window.screenLeft != undefined ? window.screenLeft : window.screenX;
edit: had to change the code. I'm not too good at compatibility code yet.
I don't know if this is the right place to post this
yep. this is the wrong place to post this. ;)
(see the guidelines for more info).
i'll move this thread to the 2.x Help forum for better mileage.
tip: you might want to check out the Ext.Element class.
Get Smart About Monitoring Virtual Machines
Microsoft Gets Ex-Streamly Cozy with U.K.'s MediaWave
|