Notificator

Developer
Size
6,780 Kb
Views
4,048

How do I make an notificator?

Forked from Artem Petrukhnov's Pen Notificator.. What is a notificator? How do you make a notificator? This script and codes were developed by Mike on 13 January 2023, Friday.

Notificator Previews

Notificator - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Notificator</title> <meta http-equiv="X-UA-Compatible" content="IE=10" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="toggler">Add notification</div>
<div class="notification-stack"> <div class="notification-item active"> <div class="notification-item__main"> <a href="#" class="notification-item__thumb" data-nf_thumb><img src="http://forward-models.com/data/articles/qAKAPOoizdkHo7fMhFqY15tLSOMnQkkLpJxRw1jKlzPSnrRK_thumb.png" alt=""></a> <div class="notification-item__info"> <div class="inner"> <a href="#" class="notification-item__close" id="close" data-nf_close></a> <a href="#" class="notification-item__settings"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="12" height="12" viewBox="249.8 250.05 12 12" enable-background="new 249.802 250.05 12 12" xml:space="preserve"><path d="M261.08 254.81h-0.47c-0.39 0-0.71-0.33-0.71-0.73 0-0.2 0.09-0.38 0.24-0.51l0.31-0.3c0.3-0.3 0.3-0.79 0-1.09l-0.7-0.69c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.29 0.29c-0.14 0.16-0.33 0.24-0.53 0.24 -0.4 0-0.73-0.32-0.73-0.71v-0.48c0-0.42-0.34-0.78-0.77-0.78h-0.95c-0.43 0-0.76 0.36-0.76 0.78v0.48c0 0.38-0.33 0.71-0.73 0.71 -0.2 0-0.38-0.08-0.52-0.23l-0.3-0.3c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.7 0.69c-0.3 0.3-0.3 0.79 0 1.09l0.29 0.29c0.16 0.14 0.24 0.33 0.24 0.53 0 0.4-0.32 0.73-0.71 0.73h-0.47c-0.43 0-0.79 0.33-0.79 0.76v0.48 0.48c0 0.42 0.36 0.76 0.79 0.76h0.48c0.39 0 0.71 0.33 0.71 0.73 0 0.2-0.09 0.39-0.24 0.53l-0.29 0.29c-0.3 0.3-0.3 0.79 0 1.09l0.7 0.69c0.14 0.14 0.34 0.22 0.55 0.22s0.41-0.08 0.55-0.22l0.3-0.3c0.13-0.15 0.32-0.23 0.52-0.23 0.4 0 0.74 0.32 0.74 0.71v0.48c0 0.42 0.34 0.78 0.77 0.78h0.95c0.43 0 0.76-0.36 0.76-0.78v-0.47c0-0.38 0.34-0.71 0.74-0.71 0.2 0 0.39 0.09 0.53 0.24l0.3 0.29c0.14 0.14 0.34 0.22 0.55 0.22 0.21 0 0.41-0.08 0.55-0.22l0.7-0.69c0.3-0.3 0.3-0.79 0-1.09l-0.31-0.3c-0.15-0.13-0.23-0.32-0.23-0.52 0-0.4 0.33-0.73 0.71-0.73h0.48c0.43 0 0.73-0.33 0.73-0.76v-0.48 -0.47C261.81 255.15 261.5 254.81 261.08 254.81zM258.33 256.05L258.33 256.05c0 1.38-1.12 2.5-2.5 2.5 -1.39 0-2.5-1.12-2.5-2.5l0 0 0 0c0-1.38 1.12-2.5 2.5-2.5C257.22 253.55 258.33 254.67 258.33 256.05L258.33 256.05z"/></svg></a> <a href="#" class="screenname">Usernickname</a> <span class="age">, 25</span> <div class="notification-item__action"> She browsed you </div> </div> </div> </div> <div class="notification-item__chat"> <div class="inner"> <input type="text" class="notification-item__chat-field" data-nf_input placeholder="Send quick message"> <input type="submit" class="notification-item__chat-send" value="Send"> </div> </div> </div> <div class="notification-item active livechat"> <div class="notification-item__main"> <a href="#" class="notification-item__thumb" data-nf_thumb><img src="http://forward-models.com/data/articles/qAKAPOoizdkHo7fMhFqY15tLSOMnQkkLpJxRw1jKlzPSnrRK_thumb.png" alt=""></a> <div class="notification-item__info"> <div class="inner"> <a href="#" class="notification-item__close" id="close" data-nf_close></a> <a href="#" class="notification-item__settings"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="12" height="12" viewBox="249.8 250.05 12 12" enable-background="new 249.802 250.05 12 12" xml:space="preserve"><path d="M261.08 254.81h-0.47c-0.39 0-0.71-0.33-0.71-0.73 0-0.2 0.09-0.38 0.24-0.51l0.31-0.3c0.3-0.3 0.3-0.79 0-1.09l-0.7-0.69c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.29 0.29c-0.14 0.16-0.33 0.24-0.53 0.24 -0.4 0-0.73-0.32-0.73-0.71v-0.48c0-0.42-0.34-0.78-0.77-0.78h-0.95c-0.43 0-0.76 0.36-0.76 0.78v0.48c0 0.38-0.33 0.71-0.73 0.71 -0.2 0-0.38-0.08-0.52-0.23l-0.3-0.3c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.7 0.69c-0.3 0.3-0.3 0.79 0 1.09l0.29 0.29c0.16 0.14 0.24 0.33 0.24 0.53 0 0.4-0.32 0.73-0.71 0.73h-0.47c-0.43 0-0.79 0.33-0.79 0.76v0.48 0.48c0 0.42 0.36 0.76 0.79 0.76h0.48c0.39 0 0.71 0.33 0.71 0.73 0 0.2-0.09 0.39-0.24 0.53l-0.29 0.29c-0.3 0.3-0.3 0.79 0 1.09l0.7 0.69c0.14 0.14 0.34 0.22 0.55 0.22s0.41-0.08 0.55-0.22l0.3-0.3c0.13-0.15 0.32-0.23 0.52-0.23 0.4 0 0.74 0.32 0.74 0.71v0.48c0 0.42 0.34 0.78 0.77 0.78h0.95c0.43 0 0.76-0.36 0.76-0.78v-0.47c0-0.38 0.34-0.71 0.74-0.71 0.2 0 0.39 0.09 0.53 0.24l0.3 0.29c0.14 0.14 0.34 0.22 0.55 0.22 0.21 0 0.41-0.08 0.55-0.22l0.7-0.69c0.3-0.3 0.3-0.79 0-1.09l-0.31-0.3c-0.15-0.13-0.23-0.32-0.23-0.52 0-0.4 0.33-0.73 0.71-0.73h0.48c0.43 0 0.73-0.33 0.73-0.76v-0.48 -0.47C261.81 255.15 261.5 254.81 261.08 254.81zM258.33 256.05L258.33 256.05c0 1.38-1.12 2.5-2.5 2.5 -1.39 0-2.5-1.12-2.5-2.5l0 0 0 0c0-1.38 1.12-2.5 2.5-2.5C257.22 253.55 258.33 254.67 258.33 256.05L258.33 256.05z"/></svg></a> <a href="#" class="screenname">Usernickname</a> <span class="age">, 25</span> <div class="notification-item__action"> She browsed you </div> </div> </div> </div> <a class="notification-item__media" href="#"> <img src="http://sharetu.com/wp-content/uploads/2015/03/blonde-model6.jpg" alt=""> <span class="notification-item__media-inner"> <span class="notification-item__button">Start live chat</span> <span class="notification-item__media-footer">LIVE <b>|</b> HD</span> </span> </a> </div> <div class="notification-item active vod"> <div class="notification-item__main"> <a href="#" class="notification-item__thumb" data-nf_thumb><img src="http://forward-models.com/data/articles/qAKAPOoizdkHo7fMhFqY15tLSOMnQkkLpJxRw1jKlzPSnrRK_thumb.png" alt=""></a> <div class="notification-item__info"> <div class="inner"> <a href="#" class="notification-item__close" id="close" data-nf_close></a> <a href="#" class="notification-item__settings"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="12" height="12" viewBox="249.8 250.05 12 12" enable-background="new 249.802 250.05 12 12" xml:space="preserve"><path d="M261.08 254.81h-0.47c-0.39 0-0.71-0.33-0.71-0.73 0-0.2 0.09-0.38 0.24-0.51l0.31-0.3c0.3-0.3 0.3-0.79 0-1.09l-0.7-0.69c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.29 0.29c-0.14 0.16-0.33 0.24-0.53 0.24 -0.4 0-0.73-0.32-0.73-0.71v-0.48c0-0.42-0.34-0.78-0.77-0.78h-0.95c-0.43 0-0.76 0.36-0.76 0.78v0.48c0 0.38-0.33 0.71-0.73 0.71 -0.2 0-0.38-0.08-0.52-0.23l-0.3-0.3c-0.14-0.14-0.34-0.22-0.55-0.22 -0.21 0-0.41 0.08-0.55 0.22l-0.7 0.69c-0.3 0.3-0.3 0.79 0 1.09l0.29 0.29c0.16 0.14 0.24 0.33 0.24 0.53 0 0.4-0.32 0.73-0.71 0.73h-0.47c-0.43 0-0.79 0.33-0.79 0.76v0.48 0.48c0 0.42 0.36 0.76 0.79 0.76h0.48c0.39 0 0.71 0.33 0.71 0.73 0 0.2-0.09 0.39-0.24 0.53l-0.29 0.29c-0.3 0.3-0.3 0.79 0 1.09l0.7 0.69c0.14 0.14 0.34 0.22 0.55 0.22s0.41-0.08 0.55-0.22l0.3-0.3c0.13-0.15 0.32-0.23 0.52-0.23 0.4 0 0.74 0.32 0.74 0.71v0.48c0 0.42 0.34 0.78 0.77 0.78h0.95c0.43 0 0.76-0.36 0.76-0.78v-0.47c0-0.38 0.34-0.71 0.74-0.71 0.2 0 0.39 0.09 0.53 0.24l0.3 0.29c0.14 0.14 0.34 0.22 0.55 0.22 0.21 0 0.41-0.08 0.55-0.22l0.7-0.69c0.3-0.3 0.3-0.79 0-1.09l-0.31-0.3c-0.15-0.13-0.23-0.32-0.23-0.52 0-0.4 0.33-0.73 0.71-0.73h0.48c0.43 0 0.73-0.33 0.73-0.76v-0.48 -0.47C261.81 255.15 261.5 254.81 261.08 254.81zM258.33 256.05L258.33 256.05c0 1.38-1.12 2.5-2.5 2.5 -1.39 0-2.5-1.12-2.5-2.5l0 0 0 0c0-1.38 1.12-2.5 2.5-2.5C257.22 253.55 258.33 254.67 258.33 256.05L258.33 256.05z"/></svg></a> <a href="#" class="screenname">Usernickname</a> <span class="age">, 25</span> <div class="notification-item__action"> She liked a video: <b>You can find full video of her here. All ....</b> </div> </div> </div> </div> <a class="notification-item__media" href="#"> <img src="http://sharetu.com/wp-content/uploads/2015/03/blonde-model6.jpg" alt=""> <span class="notification-item__media-inner"> </span> </a> </div>
</div> <script src="js/index.js"></script>
</body>
</html>

Notificator - Script Codes CSS Codes

body { padding: 20px; font-family: 'Open Sans', sans-serif; -webkit-font-smoothing: antialiased;
}
#toggler { margin: 0 0 30px 0;
}
.notification-stack { width: 300px;
}
.notification-item { box-sizing: border-box; border-radius: 2px; cursor: default; display: inline-block; position: relative; overflow: hidden; height: 0; -webkit-transition: all 0.1s ease-in; transition: all 0.1s ease-in;
}
.notification-item[data-nf_example] { display: none;
}
.notification-item__main { overflow: hidden;
}
.notification-item__thumb { background-color: #fff; width: 50px; height: 50px; overflow: hidden; float: left; opacity: 0;
}
.notification-item__thumb img { width: 100%;
}
.notification-item__close { box-sizing: border-box; color: #dfdede; padding: 0 0 0 5px; text-decoration: none; position: absolute; width: 24px; height: 24px; right: 0; top: 8px;
}
.notification-item__close::before { content: "\2715"; font-size: 11px; font-weight: 700; line-height: 24px;
}
.notification-item__close:hover { color: #c6c4c4;
}
.notification-item__settings { position: absolute; right: 24px; top: 8px; line-height: 28px; width: 24px; height: 24px; text-align: center;
}
.notification-item__settings svg { fill: #dfdede;
}
.notification-item__settings:hover svg { fill: #c6c4c4;
}
.notification-item__info { background-color: #fff; float: left; position: relative; width: 0; font-size: 14px; font-weight: 600; overflow: hidden; -webkit-transition: width 0.2s 0.2s ease; transition: width 0.2s 0.2s ease;
}
.notification-item__info .inner { padding: 8px; width: 218px;
}
.notification-item__info .screenname { color: #000; text-decoration: none; display: inline-block; vertical-align: middle; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 150px;
}
.notification-item__info .age { display: inline-block; vertical-align: middle;
}
.notification-item__action { font-size: 13px; line-height: 32px; color: #868a91; font-weight: normal; padding: 0 40px 0 0;
}
.notification-item__chat { background-color: #fff; height: 0; position: absolute; overflow: hidden; bottom: 0; left: 0; right: 0; -webkit-transition: height 0.1s ease-in; transition: height 0.1s ease-in;
}
.notification-item__chat .inner { padding: 0 8px 8px;
}
.notification-item__chat-field { border-radius: 4px; box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05) inset; background-color: #f5f5f5; border: 1px solid #dededd; border-left: none; border-bottom: none; font-size: 13px; line-height: 16px; box-sizing: border-box; padding: 5px 90px 5px 12px; height: 36px; width: 100%;
}
.notification-item__chat-field:focus { box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.15) inset; outline: none;
}
.notification-item__chat-send { background-color: #e4311e; border-radius: 0 4px 4px 0; border: none; position: absolute; right: 8px; top: 0; width: 82px; text-align: center; color: #fff; font-size: 14px; line-height: 16px; font-weight: 600; padding: 10px 5px; -webkit-transition: background-color 0.1s ease-in; transition: background-color 0.1s ease-in;
}
.notification-item__chat-send:hover { background-color: #b92616;
}
.notification-item__media { font-size: 0; position: relative; display: block; width: 300px;
}
.notification-item__media-inner { display: inline-block; vertical-align: middle; position: absolute; text-align: center; left: 0; top: 0; width: 100%; height: 100%;
}
.notification-item__media-inner::before { content: ""; display: inline-block; vertical-align: middle; height: 100%;
}
.notification-item__media-inner::after { background-color: rgba(0, 0, 0, 0.33); position: absolute; left: 0; top: 0; width: 100%; height: 100%; content: ""; z-index: 1;
}
.notification-item__media-footer { color: #fff; font-style: italic; font-weight: bold; font-size: 13px; position: absolute; left: 0; right: 0; bottom: 10px; z-index: 2;
}
.notification-item__media-footer b { font-style: normal;
}
.notification-item__media img { max-width: 100%;
}
.notification-item__button { border-radius: 3px; box-shadow: 0 3px 3px #890000; color: #fff; background-color: #d50000; font-size: 18px; text-shadow: 1px 1px rgba(0, 0, 0, 0.2); display: inline-block; vertical-align: middle; padding: 10px 20px; position: relative; z-index: 2; -webkit-transition: all 0.2s ease-in; transition: all 0.2s ease-in;
}
.notification-item__button:hover { background-color: #ef0000; box-shadow: 0 3px 3px #560000;
}
.notification-item.vod .notification-item__action { line-height: 16px; max-height: 32px; overflow: hidden;
}
.notification-item.vod .notification-item__action b { color: #000; font-weight: 600;
}
.notification-item.vod .notification-item__media-inner::before { border-left: 44px solid rgba(255, 255, 255, 0.4); border-bottom: 25px solid transparent; border-top: 25px solid transparent; height: 0; position: absolute; z-index: 2; left: 50%; top: 50%; margin: -25px 0 0 -20px;
}
.notification-item.vod .notification-item__media-inner:hover::before { border-left-color: rgba(255, 255, 255, 0.6);
}
.notification-item.active { box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.3); margin: 0 0 15px; height: auto;
}
.notification-item.active .notification-item__thumb { opacity: 1; padding: 8px; -webkit-transition: opacity 0.1s cubic-bezier(0.25, 0.1, 0.18, 1.31); transition: opacity 0.1s cubic-bezier(0.25, 0.1, 0.18, 1.31);
}
.notification-item.active .notification-item__info { width: 234px; -webkit-transition: width 0.2s 0.1s ease; transition: width 0.2s 0.1s ease;
}
.notification-item.active:not(.livechat):not(.vod):hover,
.notification-item.active.focused { padding: 0 0 44px 0;
}
.notification-item.active:not(.livechat):not(.vod):hover .notification-item__chat,
.notification-item.active.focused .notification-item__chat { height: 44px;
}
.notification-item.closed { box-shadow: none; -webkit-animation: itemHeight 0.2s ease-in forwards; animation: itemHeight 0.2s ease-in forwards; height: 0;
}
.notification-item.closed.active:hover,
.notification-item.closed.active.focused { padding: 0;
}
.notification-item.closed.active:hover .notification-item__chat,
.notification-item.closed.active.focused .notification-item__chat { height: 0;
}
@-webkit-keyframes itemHeight { from { height: 112px; } to { height: 0; }
}
@keyframes itemHeight { from { height: 112px; } to { height: 0; }
}

Notificator - Script Codes JS Codes

function addClass(el, className) { if (el.classList) el.classList.add(className); else el.className += ' ' + className;
}
function hasClass(el, className) { if (el.classList) return el.classList.contains(className); else return RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
}
function removeClass(el, className) { if (el.classList) el.classList.remove(className); else el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
}
function notificator(nf) { var self = this; self.hideNotificator = function() { if (hasClass(nf, 'active')) { addClass(nf, 'closed'); setTimeout(function() { removeClass(nf, 'active'); removeClass(nf, 'closed'); //nf.parentNode.removeChild(nf); }, 250); } return false; } self.showNotificator = function() { addClass(nf, 'active'); } nf.querySelector('[data-nf_input]').addEventListener('focus', function() { addClass(nf, 'focused'); }); nf.querySelector('[data-nf_input]').addEventListener('blur', function() { if (!this.value.trim()) removeClass(nf, 'focused'); }); nf.querySelector('[data-nf_close]').addEventListener('click', function() { alert('j'); self.hideNotificator(); });
}
var notif = document.querySelectorAll('.notification-item');
var nFs = new Array();
for (var i = 0, l = notif.length; i < l; i++) { nFs[i] = new notificator(notif[i]);
}
document.getElementById('toggler').addEventListener('click', function() { var notif = document.querySelector('[data-nf_example]').cloneNode(true); notif.removeAttribute('data-nf_example'); var parent = document.querySelector('.notification-stack'); parent.insertBefore(notif, parent.firstChild); var newNotif = new notificator(notif); setTimeout(function() { newNotif.showNotificator(); }, 100); var activeNotifCount = document.querySelectorAll('.notification-item.active').length; if (activeNotifCount > 4) { var oldNotif = document.querySelectorAll('.notification-item.active')[activeNotifCount-1]; var oldestNotif = new notificator(oldNotif); oldestNotif.hideNotificator(); }
});
Notificator - Script Codes
Notificator - Script Codes
Home Page Home
Developer Mike
Username honchoman
Uploaded January 13, 2023
Rating 3
Size 6,780 Kb
Views 4,048
Do you need developer help for Notificator?

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!

Mike (honchoman) Script Codes
Create amazing SEO content 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!