Search code examples
javascriptjquerycsswidthstylesheet

jQuery style switcher doesn't change width properly


I have a jQuery-based Style Switcher. Actually it's more like a "Width Switcher" since it only changes width.

I'm trying to modify it from here: http://bleachindonesia.com/forum/html/stylesw/style-switch.js You could see it working in here: http://bleachindonesia.com/forum/ (it's my website).

It is working fine in the original version. In this modified version I'm trying to add a "Reset" button (it is named as "Default") so the width will be changed to its default version.

<---->

It works when I use it to reset width to default and to change it to 90%. The problem appears when I try to change the width to 100% or 840px. It will always animate to those respective width at first, but then it would change to 90%.

Is there any solution?


Solution

  • It looks as if your JQuery is appending the CSS file....is it loading underneath a default file that you hard-coded in? The browser perhaps is seeing one file, rendering the page, then changing the width once it reads the 2nd CSS file.