Hey I've gone through the trouble already once before of getting an acurate reading of the x and y coordinates of an element cross-browser. I even wrote all the unit tests. It is painful! Anyways it is specific to prototype for now but could easily be optimized and convered to be jQuery-like. I don't really have the time as of right now, so this code is open to anyone that would like to convert it to a plugin.
http://www.brandonaaron.net/articles/2006/08/10/prototype-extensions-element-getoffset Brandon On 9/26/06, George Adamson <[EMAIL PROTECTED]> wrote: > > Nice idea. Quite a few plugins would find that useful. > > Another useful funtion would be a method to return the x,y (left,top) > coordinates of any element (relative to the page or some specified element). > The classic iteration through offsetParent elements would be a good start > but runs into problem with relatively positioned elements etc, and IE's own > very special box model. Perhaps someone has a solution for this. I've been > working on one gradually but I'm not there yet! (Very much > http://www.softwareunity.com/sandbox/JQueryElemXY/ work in progress !) > > I dare say there are plenty more 'useful' functions. You guys are doing a > great job of regulating what should be in the core and what should not. > Maybe someone will do a 'handyExtras' plugin some day ;) > > Cheers, > > George > > > Mark Gibson-8 wrote: > > > > Hi, > > I was thinking that due to it being such a common problem, I'd like to > > suggest adding the iframe hack for IE to the jQuery core. > > (To hide <select> elements beneath a positioned element) > > > > The plugin below appends an iframe with the necessary css so that you > > don't need any messy hacks in your normal CSS stylesheets. > > > > I've made use of IE's CSS expression() to resize the iframe to match the > > parent element - the previous suggestions of 3000px caused select's to > > the left or below to disappear. > > > > I've only tested in IE6, will it work in IE 5/5.5? > > Is it needed for IE7? > > > > $.fn.iframehack = function() { > > if ($.browser.msie) > > return this.append('<iframe > > style="display:block;position:absolute;top:0;left:0;z-index:-1;filter:mask();width:expression(this.parentNode.offsetWidth);height:expression(this.parentNode.offsetHeight)"/>'); > > else > > return this; > > }; > > > > _______________________________________________ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > > > -- > View this message in context: > http://www.nabble.com/Suggestion%3A-add-iframe-hack-to-core-jQuery-tf2337605.html#a6506401 > Sent from the JQuery mailing list archive at Nabble.com. > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/