开发者

Changing HTML page Icon?

开发者 https://www.devze.com 2023-01-20 11:10 出处:网络
I have a webpage. I want to change the icon on button down (this would be enough for me to understand but I\'d be glad if you\'d 开发者_开发知识库describe a way to animate icon after button click).If

I have a webpage. I want to change the icon on button down (this would be enough for me to understand but I'd be glad if you'd 开发者_开发知识库describe a way to animate icon after button click).


If you do want to change the favicon, jball's solution will not work, because browsers don't seem to notice when an existing <link> changes. You need to remove the existing tag and insert a new one:

$(document).ready(function(){
    $('#favicon').remove();
    $('head').append('<link href="http://example.com/favicon.ico" id="favicon" rel="shortcut icon">');
});

NB This supposes that your original favicon link has the id favicon.


http://api.jquery.com/click/

check this for click event . In that demo , remove class is using. addClass function is there.

You can change image using css itself if you want.

show() hide(); functions are there to show hide divs . you can use these too

0

精彩评论

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