CSS animated notification badge

Developer
Size
3,231 Kb
Views
273,240

How do I make an css animated notification badge?

CSS3 animated notification badge which animates on value change. What is a css animated notification badge? How do you make a css animated notification badge? This script and codes were developed by Sjmcpherson on 24 September 2022, Saturday.

CSS animated notification badge Previews

CSS animated notification badge - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS animated notification badge</title> <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import url(http://weloveiconfonts.com/api/?family=entypo);
[class*="entypo-"]:before {font-family: 'entypo', sans-serif;font-size:50px;color:#555;}
html, body {height: 100%;}
body {align-items: center;display: flex;font-family: sans-serif;justify-content: center;}
.container{position:relative;-webkit-perspective: 1000;-webkit-backface-visibility: hidden;}
.badge-num { box-sizing:border-box; font-family: 'Trebuchet MS', sans-serif; background: #ff0000; cursor:default; border-radius: 50%; color: #fff; font-weight:bold; font-size: 16px; height: 30px; letter-spacing:-1px; line-height:1.55em; top:-4px; right:-12px; border:3px solid #fff; position: absolute; text-align: center; width: 30px; box-shadow: 1px 1px 5px rgba(0,0,0, .2); animation: pulse 1.5s 1;
}
.badge-num:after { content: ''; position: absolute; top:-2px; left:-2px; border:2px solid rgba(255,0,0,.5); opacity:0; border-radius: 50%; width:100%; height:100%; animation: sonar 1.5s 1;
}
@keyframes sonar { 0% {transform: scale(.9); opacity:1;} 100% {transform: scale(2);opacity: 0;}
}
@keyframes pulse { 0% {transform: scale(1);} 20% {transform: scale(1.4); } 50% {transform: scale(.9);} 80% {transform: scale(1.2);} 100% {transform: scale(1);}
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body>
<div class="container" id="badge"> <a class="entypo-bell"></a>
</div> <script src="js/index.js"></script>
</body>
</html>

CSS animated notification badge - Script Codes CSS Codes

@import url(http://weloveiconfonts.com/api/?family=entypo);
[class*="entypo-"]:before {font-family: 'entypo', sans-serif;font-size:50px;color:#555;}
html, body {height: 100%;}
body {align-items: center;display: flex;font-family: sans-serif;justify-content: center;}
.container{position:relative;-webkit-perspective: 1000;-webkit-backface-visibility: hidden;}
.badge-num { box-sizing:border-box; font-family: 'Trebuchet MS', sans-serif; background: #ff0000; cursor:default; border-radius: 50%; color: #fff; font-weight:bold; font-size: 16px; height: 30px; letter-spacing:-1px; line-height:1.55em; top:-4px; right:-12px; border:3px solid #fff; position: absolute; text-align: center; width: 30px; box-shadow: 1px 1px 5px rgba(0,0,0, .2); animation: pulse 1.5s 1;
}
.badge-num:after { content: ''; position: absolute; top:-2px; left:-2px; border:2px solid rgba(255,0,0,.5); opacity:0; border-radius: 50%; width:100%; height:100%; animation: sonar 1.5s 1;
}
@keyframes sonar { 0% {transform: scale(.9); opacity:1;} 100% {transform: scale(2);opacity: 0;}
}
@keyframes pulse { 0% {transform: scale(1);} 20% {transform: scale(1.4); } 50% {transform: scale(.9);} 80% {transform: scale(1.2);} 100% {transform: scale(1);}
}

CSS animated notification badge - Script Codes JS Codes

(function(d){ var i = 1; var badge = document.getElementById('badge'); var int = window.setInterval(function(){ updateBadge(i++); }, 2000); //Update the badge ever 5 seconds var badgeNum; function updateBadge(alertNum){//To rerun the animation the element must be re-added back to the DOM	var badgeChild = badge.children[0];	if(badgeChild.className==='badge-num')	badge.removeChild(badge.children[0]);	badgeNum = document.createElement('div'); badgeNum.setAttribute('class','badge-num');	badgeNum.innerText = alertNum;	var insertedElement = badge.insertBefore(badgeNum,badge.firstChild); }
})(document);
CSS animated notification badge - Script Codes
CSS animated notification badge - Script Codes
Home Page Home
Developer Sjmcpherson
Username sjmcpherson
Uploaded September 24, 2022
Rating 4
Size 3,231 Kb
Views 273,240
Do you need developer help for CSS animated notification badge?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Sjmcpherson (sjmcpherson) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!