Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use icons to make an animated effect with JavaScript?
To use icons to make animated effect, the code is as follows −
Example
<!DOCTYPE html>
<html>
<head>
<style>
#user {
font-size: 60px;
color:rgb(106, 33, 201);
}
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
padding: 20px;
}
</style>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<body>
<h1>Animating Icon example</h1>
<div id="user" class="fa"></div>
<script>
function userShift() {
var userEle;
userEle = document.getElementById("user");
userEle.innerHTML = "?";
setTimeout(function() {
userEle.innerHTML = "?";
}, 1000);
setTimeout(function() {
userEle.innerHTML = "?";
}, 2000);
}
userShift();
setInterval(userShift, 4000);
</script>
</body>
</html>
Output
The above code will produce the following output −

Advertisements