JSFiddle - React, Tailwind, and code Playground

by Peter

HTML

<header>
    <span class="notify-icon"></span> 
    <div class="notify-box hide">
        <div class="header">Notifications</div>
        <div class="content">
            <a href="one"></a>
            <a href="two"></a>
            <a href="three"></a>
            <a href="four"></a>
            <a href="five"></a>
            <a href="sixe"></a>
        </div>
    </div>
</header>

CSS

body {
    background: #CCC;
    margin: 0;
    padding: 0;
}

header {
    width: 100%;
    height: 60px;
    padding: 15px;
    background: blue;
    -webkit-box-sizing:	border-box;
	-moz-box-sizing: border-box;
	-o-box-sizing: border-box;
	-ms-box-sizing: border-box;
	box-sizing: border-box;
}

.notify-icon {
    display: block;
    width: 30px;
    height: 30px;
    background: #000;
    cursor: pointer;
    z-index: 9999;
    position: relative;
    -webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.notify-box {
    background: #FFF;
    position: absolute;
    top: 50px;
    left: 0;
	opacity: 0;
    top: 70px;
    -ms-transition: opacity 0.15s ease-in-out;    
	-moz-transition: opacity 0.15s ease-in-out;
	-o-transition: opacity 0.15s ease-in-out;
    -webkit-transition:	opacity 0.15s ease-in-out;
	transition: opacity 0.15s ease-in-out;
    width: 200px;
    z-index: 9998;
}

.notify-box.show {
    opacity: 1; 
     -ms-transition: none;
	-moz-transition: none;
	-o-transition: none;
    -webkit-transition:	none;
	transition: none;
}

.notify-box.hide {
    display: none;
}

.notify-box:before {
    border-left: 10px solid transparent;
	border-right: 10px solid transparent;
	border-bottom: 20px solid #FFF;
	content: '';
    height: 0;
    left: 20px;
	position: absolute;
	top: -20px;
    width: 0;
}

.notify-box .header {
    border-bottom: 1px solid rgba(0,0,0,0.2);
    -webkit-box-sizing:	border-box;
	-moz-box-sizing: border-box;
	-o-box-sizing: border-box;
	-ms-box-sizing: border-box;
	box-sizing: border-box;
    height: 30px;
    line-height: 30px;
    padding: 0 8px;
    width: 100%;
}

.notify-box .content {
    height: 306px;
    overflow: auto;
    width: 100%;
}

.notify-box a {
    border-bottom: 1px solid rgba(0,0,0,0.2);
    display: block;
    height: 50px;
    width: 100%;
}

JavaScript

// Notify Box
(function() {
    var $notifyBox = $(".notify-box");
    var supportsStandardTransition = ($notifyBox[0].style['transition'] !== undefined);
    
    if (supportsStandardTransition) {
        $notifyBox.on('transitionEnd', function() {
            $(this).addClass('hide');
        });
    }
    
$(".notify-icon").on('click', function(){
    if ($notifyBox.hasClass('show')) {
        $notifyBox.removeClass('show');
        if (!supportsStandardTransition) {
            window.setTimeout(function () {
                $notifyBox.addClass('hide');
            }, 150);
        }
    } else {
        $notifyBox.addClass('show').removeClass('hide');
    }		
	});
})();