开发者

Jquery Check stylesheet and do action

开发者 https://www.devze.com 2023-02-08 13:03 出处:网络
me again! I\'m learning a lot from this site! Now.. i want to know how do i check with jQuerywhat stylesheet i\'m using and perform an action. In the case, place a favicon..

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"));
0

精彩评论

暂无评论...
验证码 换一张
取 消