Jquery Check stylesheet and do action
me again! I'm learning a lot from this site!
Now.. i want to know how do i check with jQuery what stylesheet i'm using and perform an action. In the case, place a favicon..
i have this script for change stylesheet on my page:
$("#painel_faccao li a").click(function() {
$("link#faccao").attr("href",$(this).attr('rel'));
$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
return false;
});
开发者_开发百科
and my favicon on page:
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
i know i must use this:
$("#favicon").attr("href","favicon2.png");
but i don't know how to make jquery check the stylesheet..
someone can help me?
To check which stylesheet is used, you can check the link href
just like you are on the favicon.
alert ("Your stylesheet is: " + $("link[rel='stylesheet']").attr("href"));
精彩评论