- This topic is empty.
-
AuthorPosts
-
October 17, 2011 at 9:48 pm #34805
skcirtssc
MemberHello :-)
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.
I have a working animation but I can’t get the :visited part to work, basically I fail to cancel the animation.
Here’s the code I use http://jsfiddle.net/elddifsj/cKeSV/
P.S. I do not want a javascript solution.
October 17, 2011 at 11:06 pm #89197joshuanhibbert
Membera:visited { animation: none; }
Heh, scrap that. It works for :hover but not for :visited. Strange…
October 17, 2011 at 11:16 pm #89198skcirtssc
Member@joshuanhibbert
Doesn’t work, and doesn’t look like a valid declaration.October 17, 2011 at 11:33 pm #89200joshuanhibbert
MemberWhy doesn’t it look like a valid declaration? It works fine on :hover, I have tested it.
October 17, 2011 at 11:45 pm #89201skcirtssc
MemberDoesn’t look valid because it’s a shorthand with 6 values and the only one where none is allowed is the name.
From my test :hover works in webkit, :visted works nowhere.
Have you got a demo ?October 18, 2011 at 12:08 am #89202chrisburton
ParticipantTry testing outside of jsfiddle?
October 18, 2011 at 12:08 am #89204joshuanhibbert
MemberShorthand doesn’t require each value to be present, only those you are using. Think about the shorthand for background, it still works fine if you only declare a color.
Here is a test case: http://tinkerbin.com/c0SK9ejA
The other way you can do it, if you don’t want to use animation: none; is to set the animation on the following selecter:
a:not(:visited)
Although that won’t work yet as we have learnt that animations don’t play nice with the :visited pseudo-class.
October 18, 2011 at 12:34 am #89203skcirtssc
MemberOk apparently animation-name: none means no animation, kinda weird.
I’m testing my code and joshuanhibbert’s both locally and on the sites, the animation pauses on hover but continues on visited. I use Coda, Safari 5.1, FF 5, Chrome 12. The other properties like color on visited don’t always work. The animation seems to mess things up.
October 18, 2011 at 12:51 am #89205skcirtssc
Member”Although that won’t work yet as we have learnt that animations don’t play nice with the :visited pseudo-class. ”
You mean :not pseudo class ? otherwise where have we learnt this ? you told me earlier that it should workOctober 18, 2011 at 12:53 am #89206chrisburton
ParticipantNo, :not is an invalid selector.
October 18, 2011 at 12:59 am #89207joshuanhibbert
Member@skcirtss animation-name: none; doesn’t mean don’t run any animation. It means run the animation with the name of none. As there isn’t one defined it runs nothing. In regards to where we learnt that animations don’t play nice with :visited, refer to my first comment:
It works for :hover but not for :visited. Strange…
October 18, 2011 at 1:13 am #89209chrisburton
ParticipantProbably because I’ve never heard of it until reading the spec. Which shows it was JUST introduced. My fault.
October 18, 2011 at 1:14 am #89210skcirtssc
MemberSee http://www.w3schools.com/cssref/css3_pr_animation-name.asp
It says “Specifies that there will be no animation”
If it meant the animation named none then it wouldn’t cancel the animation because there can be several on the page.I didn’t see your edited comment, better post a new message.
October 18, 2011 at 1:15 am #89211joshuanhibbert
Member@skcirtssc You are correct, I tested that and it wouldn’t run an animation named none. That also means that the shorthand I was using earlier is correct (animation: none;).
October 18, 2011 at 1:18 am #89212chrisburton
Participant@joshuanhibbert: @ChristopherBurton It was introduced with CSS3, I wouldn’t regard CSS3 as JUST introduced
read the date? I didn’t say “CSS3 was just introduced”
edit: Also, please reply instead of changing your post several times. Quirksmode introduced :not into the spec 15 months ago, is that what you’re saying or are saying he mentioned it and it became part of the spec?
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.