Looking to make changes to the CSS of a page, there are two methods that come to mind:
Option 1: Utilize the Jquery .css
function to modify every tag in the HTML. For instance:
$("body").css("background : red")
Alternatively, you can disable the current CSS stylesheet and activate a new one.
For example:
function switch_style ( css_title )
{
// Feel free to use this script on your website as long as
// you retain this notice or link below. The script can be found at
// http://www.thesitewizard.com/javascripts/change-style-sheets.shtml
var i, link_tag ;
for (i = 0, link_tag = document.getElementsByTagName("link") ;
i < link_tag.length ; i++ ) {
if ((link_tag[i].rel.indexOf( "stylesheet" ) != -1) &&
link_tag[i].title) {
link_tag[i].disabled = true ;
if (link_tag[i].title == css_title) {
link_tag[i].disabled = false ;
}
}
}
}
Which method is more efficient? Or perhaps there are better approaches available?