I am new to jquery, and I am trying to load HTML and CSS from a database and
have them applied dynamically to the document. The CSS is returned as a
string and I am using the cssEngine plugin to change the CSS:

 

$.cssEngine.createStyle(myCSS,'page_theme');    

 

Everything is working fine, the CSS gets applied correctly, however, as I
toggle between different CSS the screen does not seem to completely redraw -
until the window is resized. For example, between two sets of CSS, the
background color changes - but it doesn't update until the window is
resized. Then it redraws correctly. So my question is, is there someway to
force a redraw?

 

The createStyle method from the ccEngine plugin source is below:

 

if($.browser.msie){

      rules=document.createElement("style");

      rules.setAttribute('type', 'text/css');

      rules.styleSheet.cssText=cssText;

      $("head")[0].appendChild(rules);

}else

      var rules = $("head").append('<style
type="text/css">'+cssText+'</style>')[0].lastChild;

      if(id)

            $(rules).attr("id", id);

      var fClasses = this.classes || this.getClasses(true);

      var obj = rules.styleSheet ? rules.styleSheet : (rules.sheet ||
document.styleSheets[document.styleSheets.length-1]);

      $.each((obj.cssRules || obj.rules), function(){fClasses.push(this);});

return rules;

}

};

 

Reply via email to