I want to infinitely pulse the background colour of an identified anchor with CSS animation, and get rid of the animation altogether (= make the anchor look like other anchors) when it’s visited. The purpose is to show that a page has been updated and pulsate the link to it until the page has been visited with :visited instead of a cookie.
I have a working animation but I can’t get the :visited part to work, basically I fail to cancel the animation. Apparently the animation is cancelled for :hover with the declaration animation:none; or animation-name:none; but for :visited there’s a bug.
I’d like to know what exactly is going on and what are the possible workarounds.
Here’s the code I use
<html>
<head>
<title></title>
<style type="text/css">
#pulsing_bg:link {
color: red;
background-color: yellow;
border: 1px dashed green;
animation: a_link 1s linear 0s infinite normal;
-moz-animation: a_link 1s linear 0s infinite normal;
-webkit-animation: a_link 1s linear 0s infinite normal;
}
#pulsing_bg:visited {
color: lime;
background-color: fuchsia;
border: 1px dashed red;
animation: none;
-moz-animation: none;
-webkit-animation: none;
/*
animation: a_link 0s linear 0s 0 normal;
-moz-animation: a_link 0s linear 0s 0 normal;
-webkit-animation: a_link 0s linear 0s 0 normal;
*/
}
@keyframes a_link
{
100% {background-color: green;}
}
@-moz-keyframes a_link
{
100% {background-color: green;}
}
@-webkit-keyframes a_link
{
100% {background-color: green;}
}
</style>
</head>
<body>
Pellentesque mollis ante eget metus auctor adipiscing. <a href="#8" id="pulsing_bg">Sed sit amet sapien in erat gravida mollis.</a>Nam quis libero nec mauris vestibulum lacinia.
<br>
Proin aliquet, nibh vel aliquam mollis, <a href="#10" id="pulsing_bg">Nullam et enim ligula.</a> ipsum lacus egestas erat, vehicula tempor augue nulla convallis odio.
</body>
</html>
Ah crap, I heard about this. I read on other pages that transitions aren’t allowed, but they say nothing about animations. Do you have an accurate list of what’s allowed/disallowed ?
No I’m afraid not. Some are mentioned in the link I posted but I would guess it varies between browsers also. It’s generally accepted than only colours should be changed on visited links.
Yes I have set it to infinite, but animation: none; or animation-name: none; should cancel it whatever its properties, right ?
I tried with 0 or 1 iteration, didn’t stop it.
We established right back at the start that the animations don’t work on visited states. No fiddling around with the properties is going to make them work unfortunately.
It’s either that visited states have not been implemented or it may be because of the security issues I mentioned above as I guess animations require resources that can be traced to identify the history (that’s just a guess though).