Nothing should be labeled as “strange” when it comes to IE anymore, but I find this one particularly peculiar.
Here’s the CSS:
[code]
#header li a {
display: block;
padding: 15px 30px 5px 0;
text-transform: uppercase;
color: #000;
font-family: helvetica,arial,sans-serif;
background: url(layout/pngsprites.png) -160px -232px no-repeat;
}
Here’s the Javascript (using jQuery) where elem is a jquery object reference the #header li a element:
[code
var bgpos_ = elem.css(‘backgroundPosition’).split(” “);
[/code]
Works fine in browsers other than IE. So I went a bit deeper into it, I tried specifically declaring the background-position property in the CSS in hopes that IE could find it:
[code]
background: url(layout/pngsprites.png) -160px -232px no-repeat;
background-position: -160px -232px;
But nothing….then I even tried using plain old JS to get it using the style property:
[code]
alert(elem.get(0).style.backgroundPositiong);
But IE still played foul.
I googled around, figuring this was a common issue, but I haven’t found anything……what’s the fix?
EDIT: [url]http://stackoverflow.com/questions/594870/fix-for-background-position-in-ie
Apparently it only supports the non-standard background-position-[x|y]
Final code (again in jQuery):
[code]
this.bgy = (elem.css(‘background-position-x’)) ? parseInt(elem.css(‘background-position-y’)) : parseInt(elem.css(‘backgroundPosition’).split(” “)[1]);