Created
January 23, 2021 21:18
-
-
Save Alkimisti/3162626f01c5b3c186daf4ae65b49132 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>animation-play-state</title> | |
<style> | |
@keyframes levizja { | |
from { | |
left: 0; | |
} | |
to { | |
left: 400px; | |
} | |
} | |
#teksti { | |
background-color: yellow; | |
padding: 20px; | |
margin-top: 20px; | |
width: 400px; | |
height: 40px; | |
position: relative; | |
animation: levizja 5s infinite alternate; | |
animation-play-state: paused; | |
} | |
</style> | |
</head> | |
<body> | |
<button id="play">Play</button> | |
<button id="pause">Pause</button> | |
<div id="teksti">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Cupiditate voluptates officiis quis quos | |
ipsa quisquam. | |
</div> | |
<script> | |
document.querySelector("#play").addEventListener('click', (event) => { | |
document.querySelector("#teksti").style.animationPlayState = "running"; | |
}) | |
document.querySelector("#pause").addEventListener('click', (event) => { | |
document.querySelector("#teksti").style.animationPlayState = "paused"; | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment