Does it matter if the dimensions are set in an attached stylesheet instead
of inline styles?
I have a toolbar and items look something like this:
<div class="tb_main">
<div class="tb_item"><img src="images/spacer.gif" class="btn1"/>
<span>Do something</span></div>
<div class="tb_item"><img src="images/spacer.gif" class="btn2"/>
<span>Do something Else </span></div>
</div>
With the CSS like this:
div.tb_main { position:fixed;left:0px;top:0px;height:30px;width:auto; }
div.tb_mainie6 { position:absolute; }
div.tb_item { float:left;margin:3px; }
div.tb_item img {
vertical-align:middle;width:16px;height:16px;background-image:url(images/spr
ites.png); }
div.tb_item span { vertical-align:middle;padding-left:10px;}
img.btn1 { background-position:-32px -64px }
img.btn2 { background-position:-48px -64px }
So there is a width and height, but they are not defined in the attributes
of the <img> tag, nor in the inline styles of the images.
Also note that the containing div.tb_main has an expressly defined css
height.
Yet after creation and adding to the DOM (appended to document.body), the
calculated height is sometimes the full document height (1000px or
whatever). This only happens when the element is POSITION:FIXED - the
problem goes away with POSITION:ABSOLUTE.
It's also not consistently reproducible (arrrgh), and it only happens in
webkit browsers.
For my own project, I have a workaround of not detecting the toolbar height,
but assuming its 30px, hard-coded into my script.
My fear is that this may be an underlying browser bug without a safe patch
for it in the dimensions engine.
JK
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Brandon Aaron
Sent: Wednesday, November 05, 2008 12:44 PM
To: [email protected]
Subject: [jquery-dev] Re: Window height in Safari is incorrect
Jeff, do you have any images in the page or toolbar that don't have
width/height set? This has caused issues like you are describing for me in
the past in webkit based browsers.
I'll see if I can't get around to taking a look at the window height issue
later today.
--
Brandon Aaron
On Wed, Nov 5, 2008 at 2:31 PM, Jeffrey Kretz <[EMAIL PROTECTED]> wrote:
To add to this, I al have an error I (cannot consistently reproduce it,
unfortunately) about height being incorrectly calculated.
I have an "Admin Toolbar" added to the top of my CMS page, set for
"position:fixed" the document.body element is moved down by the height of
the toolbar.
Periodically, when the toolbar is added, the .height() function, as well as
the el[0].clientHeight property returns the FULL document height (rather
than something small like 30px), causing my program to move the
document.body element WAAAAAYYYY down the page.
If I set a timeout of like 100ms before measuring the height, it comes out
correctly.
But immediately following the creation:
$('<blabla>').appendTo(document.body) the height was calculated incorrectly.
It happened on Chrome, Safari Mac and Safari PC, but not on IE6/7, FF2/3 and
Opera, so I believe this is a bug in the underlying Webkit rendering engine.
I've hacked it for now, hard coding the height of the toolbar, as I don't
see a good workaround to what I believe is an underlying bug in the engine.
JK
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jeffrey Kretz
Sent: Wednesday, November 05, 2008 12:17 PM
To: [email protected]
Subject: [jquery-dev] Re: Window height in Safari is incorrect
I agree, and I have noticed this problem with other Webkit browsers, namely
Chrome and Safari for Windows.
I haven't gotten around to a suggested workaround for it yet, but I'll need
to solve it before I launch my project, which works fine on IE6/7 FF2/3 and
Opera, but not on Safari Mac/Win and Chrome.
JK
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tim Molendijk
Sent: Wednesday, November 05, 2008 11:34 AM
To: jQuery Development
Subject: [jquery-dev] Window height in Safari is incorrect
http://dev.jquery.com/ticket/3578
people agree?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---