Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE 8 background-position issue in 0.6.2 had to rever to 0.4.0 #34

Open
htmlr opened this issue Apr 23, 2013 · 3 comments
Open

IE 8 background-position issue in 0.6.2 had to rever to 0.4.0 #34

htmlr opened this issue Apr 23, 2013 · 3 comments

Comments

@htmlr
Copy link

htmlr commented Apr 23, 2013

Cant put my finger on the issue but it in IE 8 version 0.6.2 initializes background position to 50% 50% overwriting initial stylesheet value. However version 0.4.0 keeps stylesheet value.

Heres my CSS:

.section { background-position:50% 0px; background-repeat:no-repeat; background-attachment:fixed; }

intro.section { background-image: url(../images/cc_cloud_bg.jpg); }

team-a.section { background-image: url(../images/cc_newyork_bg.jpg); }

team-b.section { background-image: url(../images/cc_aloisi_bg.jpg); }

@getdave
Copy link

getdave commented May 10, 2013

IE9 and below are reporting false background position. My CSS is set to 50% 50% but

$elem.css('background-position');

reports "0% 0%"

@getdave
Copy link

getdave commented May 10, 2013

Ok I figured this out. If you do the following in your CSS:

`background-position: 50% 50%``

then $elem.css('background-position-x') returns a px based value.

However if you use a keyword-based approach like this

`background-position: center center``

then the reported value is the keyword.

However IE9 is still reporting 0% 0%. This probably relates to jquery/jquery#748

@ghost
Copy link

ghost commented Dec 11, 2014

You can do something like this

First install jquery migration

https://github.com/jquery/jquery-migrate/#readme

Include these on your html

The $.browser property allows you to target browsers you want to apply your style into

In this case for background-position can be changed to property supported backgroundPosition

Available flags are - webkit - safari - opera - msie (for IE) - mozilla

Example for IE or Firefox

if ( $.browser.msie || $.browser.mozilla) {
$(".section").css('backgroundPosition', position + "px 0");
}
for chrome

if ( $.browser.webkit) {
$(".section").css('backgroundPosition', position + "px 0");
}
I got mine working on IE8 and firefox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants