I have a simple function on javascript when you click a button called "en" to change language. Works fine by changing a text .text, but I have an issue and is that I've created an animation with css and some text placeholders. let me show you.
HTML
<div id="languageWrapper">
<img id="es" class="spanish" src="images/es.svg"/>
<img id="en" class="english" src="images/en.svg"/>
</div>
These are the buttons to Change the language
The content I can't achieve to change is this one
<div id="bannerWrapper">
<div id="textWrapper">
<h3 class="headerWrapper"></h3><br>
<h3 class="subheaderWrapper"></h3>
</div>
</div>
The text from .headerWrapper and .SubheaderWrapper comes from a CSS file
CSS
.headerWrapper {
position: relative;
color: #fff;
margin: 0 auto;
font-family: 'Montserrat', sans-serif;
font-size:40px;
}
.headerWrapper:after {
content: 'Header 1';
animation: faderText 30s cubic-bezier(.8,0,0,.8) infinite;
}
.subheaderWrapper {
position: relative;
color: #fff;
margin: 0 auto;
font-family: 'Raleway', sans-serif;
font-size:17px;
}
.subheaderWrapper:after {
content: 'Some small description of what We intent to say here in this banner
number 1';
animation: faderText2 30s cubic-bezier(.8,0,0,.8) infinite;
}
@keyframes faderText {
0% {content: "¿Empresa vs Autónomo?";}
33.33% {content: "¿Qué impuestos paga mi Empresa?";}
66.66% {content: "¿Que visado necesitan mis empleados extranjeros?";}
100% {content: "¿Empresa vs Autónomo?";}
}
@keyframes faderText2 {
0% {content: "Te aconsejamos y creamos la mejor estructura según tu tipo de
negocio";}
33.33% {content: "Nos encargamos de explicar , preparar y presentar tus
impuestos periódicamente";}
66.66% {content: "Construimos un puente entre la compleja red de tramites al
reubicar internacionalmente a un empleado";}
100% {content: "Te aconsejamos y creamos la mejor estructura según tu tipo de
negocio";}
}
What I'm trying to achieve is, while clicking the id #es to change the animation keyframes from faderText and faderText2 to maybe another different animations with the content in English. is this possible? Thanks in advance!!
Also here's my Javascript that I want to achieve (change .headerwrapper:after animation from faderText to faderTextEnglish) So while creating the faderTextEnglish keyframes i can make them in english.)
$('#en').click(function(){
$('.headerWrapper:after').css('animation','faderTextEnglish 30s cubic-bezier(.8,0,0,.8) infinite');
});
Someone can help:D? thanks!