[jQuery] Re: dimensions, RTL and IE offset problem
OK, I found a workaround: I wrap the whole document with a div and use that div's left offset value as a calibrator. This works in FF3 and IE7, but not Safari. My questions are: 1 - Is there a simpler way to do the wrapping than what I'm doing? 2 - Is there a better way to create the "patched" offset? 3 - Does anyone know why this doesn't work in Safari? My code: http://www.w3.org/TR/html4/strict.dtd";> (function($) { var outer; $.fn.old_offset = $.fn.offset; $.fn.offset = function () { offset = this.old_offset(); offset.left -= outer.old_offset().left; return offset; } $(function() { outer = $(""); $("body").children().appendTo(outer); $("body").append(outer); outer.height($(window).height()); outer.width($(window).width()); $(window).resize(function () { outer.height($(window).height()); outer.width($(window).width()); }); }); })(jQuery); $(function() { for(var i=0; i< 200; i++) { $("#overflow_text").append('x'); } offset = $("#coverme").offset(); $("#moveme").css(offset); $(window).resize(function() { $("#moveme").css($("#coverme").offset()); }); }); text Thanks
[jQuery] Re: dimensions, RTL and IE offset problem
Hmm... adding a DOCTYPE tag at the top of the html seems to resolve this. Can anyone shed light on this? However, now I have a different problem: when content grows to the left, offset().left seems to grow by the overflow size. http://www.w3.org/ TR/html4/strict.dtd"> $(function() { for(var i=0; i< 300; i++) { $("#overflow_text").append('x'); } offset = $("#coverme").offset(); $("#moveme").css(offset); }); On Jun 30, 8:38 am, iTsadok <[EMAIL PROTECTED]> wrote: > There seems to be a skew when using offset() in a right-to-left > layout, but only in Internet Explorer. > These boxes align perfectly in Firefox and Safari, but IE7 puts the > green box lower and to the right. Setting the margin doesn't seem to > have any effect. > > > > > > > $(function() { > $("#moveme").css($("#coverme").offset()); > }); > > > > > id="coverme"> > > > >