Changing stylesheet href with jQuery doesn't quite work
Posted
by Michael Itzoe
on Stack Overflow
See other posts from Stack Overflow
or by Michael Itzoe
Published on 2010-06-09T16:10:15Z
Indexed on
2010/06/09
21:42 UTC
Read the original article
Hit count: 223
I'm creating a web app that user will be accessing in the field, so they'd like to be able to manually toggle the styles from light to dark depending on the ambient lighting. I'm using jQuery.
I added an id
attribute to my stylesheet, then created a button using the toggle()
event, in which I change the href
attribute to the CSS file I want. The CSS file has several @import
directives as I split the styles into several files for maintainability.
My problem is only the main CSS file is being applied. I tried using the absolute path in the @import
directives, but no luck.
Is there a fix here I'm missing, or do I have to inlcude everything in a single CSS file?
Edit:
Apprently this is only a problem in IE8, works fine in Chrome and Firefox. Unfortunately, my client wants only IE8. Looks like this is a duplicate of this question.
© Stack Overflow or respective owner