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).
A:
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
zod
2010-10-12 20:56:16
+4
A:
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
.
lonesomeday
2010-10-12 21:02:11
Looks like you're right about needing to insert the new one. I would still use `$("#favicon")` instead of `$('link[rel=shortcut icon]')` unless there's some reason that doesn't work.
jball
2010-10-12 21:16:00
@jball So would I -- changed. Thanks.
lonesomeday
2010-10-12 21:22:41