IE element position...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] IE element positioning

10 Posts
5 Users
0 Reactions
57 Views
Posts: 0
Free Member
Topic starter
 

I've failed to solve this after hours of hunting around. I have a span containing text elements. In firefox I can index the childNodes array and use offsetLeft and offsetWidth to insert breaks if the span gets wider than the screen, but in IE these values are -1 and 0, and using the script debugger there don't seem to be any properties to tell me where they are...


 
Posted : 14/02/2010 5:30 pm
Posts: 0
Free Member
 

IE sucks bigtime. I hate testing anything in it.


 
Posted : 14/02/2010 6:02 pm
Posts: 0
Free Member
Topic starter
 

IE sucks bigtime. I hate testing anything in it.

sho nuff, but lots of people still use it 🙁 What puzzled me is IE8 is supposed to much more standards compliant, yet things [b]still[/b] don't work...


 
Posted : 14/02/2010 6:07 pm
Posts: 1
Free Member
 

You able to share the css?


 
Posted : 14/02/2010 6:16 pm
Posts: 0
Free Member
Topic starter
 

You able to share the css?

[url= http://www.bogtrotters.org/show_album_shot2.php?jumpid=39377 ]this what I'm doing[/url], I have a string of tags which I want to fit within the screen width (ignoring the case when the window isn't full screen), so I can keep them visible as the window scrolls when you click a tag. For now I've forced the span to have width=screen.width if it's IE, but this acts a bit stupid if the span is initially narrower 🙁 Unfortunately I can't discover the span width


 
Posted : 14/02/2010 6:22 pm
Posts: 54
Free Member
 

have you tried changing it from a span to a div? Might sound daft but span's are the bane of my life when trying to add cross-browser friendliness at work...


 
Posted : 14/02/2010 7:16 pm
Posts: 54
Free Member
 

oh, and from memory you could do something like use clientWidth (?) when referencing the element in javascript so not sure document.getElementById(spanid).clientWidth would work or not? Again, from the deepest depths of my memory so maybe I'm imagining things...


 
Posted : 14/02/2010 7:21 pm
Posts: 0
Free Member
Topic starter
 

have you tried changing it from a span to a div?

I did wonder if using a div with style 'display:inline' might work, I'll try it 🙂

edit: no difference 🙁 As far as I can see, the only difference between a span and a div is that a div has block display by default


 
Posted : 14/02/2010 7:45 pm
Posts: 0
Free Member
Topic starter
 

I found the solution - IE doesn't set the offsetWidth etc properties till the screen is redrawn, so you have to set an onload event handler or onresize subsequently followed by a setInterval asynchronous callback!


 
Posted : 20/02/2010 7:00 pm
Posts: 0
Free Member
 

IE - spawning inelegant solutions for a decade.

:O)


 
Posted : 20/02/2010 7:29 pm
Posts: 0
Free Member
Topic starter
 

IE - spawning inelegant solutions for a decade.

yeah, tell me about it 🙁


 
Posted : 20/02/2010 7:31 pm

6 DAYS LEFT
We are currently at 95% of our target!