CSS Inception with Kynetx
My solution was to harvest the load external stylesheet code from the KRL runtime and wrap it in a defaction.
loadStylesheet = defaction(cssURL) {
loadCode = <<
var head=document.getElementsByTagName('head')[0];
var new_style_sheet=document.createElement("link");
new_style_sheet.href="#{cssURL}";
new_style_sheet.rel="stylesheet";
new_style_sheet.type="text/css";
head.appendChild(new_style_sheet);
>>;
emit << eval(loadCode); >>;
};
Now I can load external stylesheets programatically:
rule inject_css {
select when click "#ignite"
{
loadStylesheet("http://assets.lobosllc.com/css/inception.css");
}
}
This entry was posted on Oct 25, 2011
, Tuesday, October 25, 2011 and is filed under css,defaction,kynetx. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response.













