
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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 −
- Related Articles
- How to use an animated image in HTML page?
- How to use the Glyphicons icons in Bootstrap
- How to create an animated search form with CSS?
- How to create an animated, closable side navigation menu with CSS?
- How to create a typing effect with JavaScript?
- How to create a form with icons using CSS?
- How to create an overlay effect with CSS?
- How to plot an animated image matrix in matplotlib?
- How to create an Animated Art on Your Linux Terminal?
- How to make a fullscreen window with JavaScript?
- How to set the shadow effect of a text with JavaScript?
- How to set when the transition effect will start with JavaScript?
- How to use map() on an array in reverse order with JavaScript?
- How to use media queries with JavaScript?
- How to make an area unclickable with CSS?

Advertisements