I am trying to fade in and out 4 pieces of text over a 28 second period. I am using opacity and color change on the text to try and make this work. It works in Chrome and Firefox - but not Safari. I am using an HTML attr to call-in data. Please see codepen for example. Thanks for the help in advance. Ps. I have tried with and without -webkit- and this doesn’t seem to be the issue.
https://codepen.io/davidlower8/pen/wvMJwvm
<h2 class="hero-animated-text" data-1="Loving it 1" data-2="Loving it 2" data-3="Loving it 3" data-4="Loving it 4"></h2>
.hero-animated-text:before
{
content: '';
animation-name: hero-text;
animation-duration: 28s;
animation-iteration-count: infinite;
animation-timing-function: ease-out;
-webkit-animation-name: hero-text;
-webkit-animation-duration: 28s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-out;
opacity: 0;
color: white;
}
@-webkit-keyframes hero-text
{
12.5%
{
content: attr(data-1);
opacity: 1;
color: color(1);
}
25%
{
opacity:0;
color: white;
}
37.5%
{
content: attr(data-2);
opacity: 1;
color: color(1);
}
50%
{
opacity:0;
color: white;
}
62.5%
{
content: attr(data-3);
opacity: 1;
color: color(1);
}
75%
{
opacity:0;
color: white;
}
87.5%
{
content: attr(data-4);
opacity: 1;
color: color(1);
}
100%
{
opacity: 0;
color: white;
}
}