how to add css animation to an element of the skin

Q&A about the latest versions
Post Reply
Fgorge
Posts: 6
Joined: Mon Mar 29, 2021 2:16 pm

Hello,
In an HTML web page I wrote this little script and CSS to animate a <div> using CSS animation :

Code: Select all

function play_FG(whichElement) {
	element= document.getElementById(whichElement);
	element.classList.add("animation_FG");
    element.style.animationPlayState = "running";
}

function pause_FG(whichElement) {
	element= document.getElementById(whichElement);
	element.classList.remove("animation_FG");

}
CSS :

Code: Select all

.animation_FG {
 animation-name: fade_anim_FG;
  animation-duration: 1s;
  animation-play-state: paused;
  animation-iteration-count: infinite;
  }

@keyframes fade_anim_FG {
  50% {opacity: 40%;}
}

Code: Select all

<button onmouseover="play_FG('targetRed')" onmouseleave="pause_FG('targetRed')" >Play Red</button>
Everything work fine in a simple HTML page with a div with an ID named targetRed.

But inside my skin, when I try to modify an element ID = targetRed using a simple javascript :

Code: Select all

javascript:
play_FG('targetRed');


I've got this error
.
error js.jpg
error js.jpg (94.63 KiB) Viewed 23809 times
Any help will be very appreciated.
F.
Post Reply