jQuery to change style sheet (like a theme switcher), doesn't load CSS in IE
So the page is here: http://www.sumsy.com/testing/1/login.html
It works in FF, but no IE.
The problem is:
Click on Change Theme, select the second box(blue box), the site should switch to a new theme,
However, in IE, it just doesn't load any CSS style. I did some debugging. The style sheet link attr
is actually changed.
Can you guys please shed some开发者_开发百科 light?
You can see the JS (mainly theme-switcher.js) and HTML code from view source. If you need me to paste the code here, please let me know.
Updating link
elements dynamically has highly variable behaviour. I found the same issue when (for some crazy reason) I wanted to dynamically change favicon links. The best solution is to remove the old link and replace it with a new one:
$('#active-theme').replaceWith($('<link>', {
id: 'active-theme',
href: 'themes/' + get_cookie + '/_css/main.css',
type: 'text/css',
rel: 'stylesheet'
}));
精彩评论