Hello, I am trying to use both an external stylesheet and Bootstrap in a project. The stylesheet works fine by putting the following into the Toolbar Custom JavaScript field:
$('<link>')
.appendTo($('head'))
.attr({type : 'text/css', rel : 'stylesheet'})
.attr('href', 'Content/Resources/custom_skin.css');
I thought I would do the same for Bootstrap. I put this in, but nothing appears and I don't get any console errors:
$('<link>')
.appendTo($('head'))
.attr({type : 'text/css', rel : 'stylesheet'})
.attr('href', 'Content/Resources/bootstrap-3.3.6-dist/css/bootstrap.min.css');
$('<script>')
.appendTo($('head'))
.attr('href', 'Content/Resources/bootstrap-3.3.6-dist/js/bootstrap.min.js');
So questions, Is this not a way of using Bootstrap in a project? What would be the right way of going about this?
Thanks for any help anyone can lend.
External Stylesheet and Bootstrap Usage
Re: External Stylesheet and Bootstrap Usage
Adding this to the Toolbar Custom JavaScript in a tripane skin just makes it available in the skin frames, not the topics.
So I take it you're trying to use bootstrap in the skin frames?
You can certainly append CSS script links this way (I wrote a blog post about it here), but I'm pretty sure appending a script to the head will not work (or at least the script may be added, but not actually run).
So why not just copy/paste the bootstrap script into the custom javascript section?
Then it'll be included and run with your output.
So I take it you're trying to use bootstrap in the skin frames?
You can certainly append CSS script links this way (I wrote a blog post about it here), but I'm pretty sure appending a script to the head will not work (or at least the script may be added, but not actually run).
So why not just copy/paste the bootstrap script into the custom javascript section?
Then it'll be included and run with your output.