grunwaldlab / quiltr

R package for making website representations of directories
http://grunwaldlab.github.io/quiltr/
5 stars 1 forks source link

Add option to apply theme css to iframe HTML #42

Closed zachary-foster closed 9 years ago

zachary-foster commented 9 years ago

Currently, the notes imported into the website via iframes do not have the Bootstrap theme's css. This might be a solution: http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe

zachary-foster commented 9 years ago

This seems to work:

<script language="JavaScript">
<!--
function apply_theme(id){
  var cssLink = document.createElement("link");
  cssLink.href = "libs/bootstrap-3.3.1/css/cosmo.min.css"; 
  cssLink.rel = "stylesheet"; 
  cssLink.type = "text/css"; 
  document.getElementById(id).contentWindow.document.head.appendChild(cssLink);
}
//-->
</script>
<iframe src="notes.html" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="apply_theme('iframe1'); autoResize('iframe1');">