Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">



<html>


<div id="header" class="header">
  <div class="logo"></div>
  <div class="icon_container">
          <span id = "369" class="username span"> Welcome, Mr. Messmer </span>
          <i class="float icon fas fa-tasks"></i> 
          <i id="line" class="line"><span id="notification" style="padding-left: 15px;" id="notification" class="float fas icon notification"></span></i>
          <i class="float icon fas fa-user-tie"></i>
          <i class="float bars fas fa-bars" style="margin-left: 25px;"></i>
   
    <nav>
  
     
  
</nav>



  <div id="cart" class="shopping-cart">
    <div class="shopping-cart-header" style="font-size: 30px">
      <span>Notifications</span>
      <span style="font-size: 20px; font-weight: 400; color: rgb(114, 114, 114)"><p>October 12, 2018</p></span>
      <div class="row">
        <span id="rec" style="font-size: 15px; padding-left: 15px; padding-right: 10px; margin-top: -3px;">Recents</span>
    <input class="tgl tgl-light" id="cb1" type="checkbox"/>
    <label class="tgl-btn" for="cb1"></label>
        <span id="type" style="font-size: 15px; font-weight: 400; padding-left: 12px; padding-right: 10px; margin-top: -3px;     color: rgb(180, 180, 180);">Type</span>
        <span class="clear">Clear All</span>
        
      </div>
    </div> <!--end shopping-cart-header -->

    <div class="shopping-cart-items">
      <section>
        <div class="cart-date">October 5, 2018</div>
      <div id="item-1" class="cart-item">
        <div class="cart-type">System</div>
        <div class="cart-item-header"> outage on 10/15/2018</div>
        <div class="cart-item-date">10/05/2018 :: 12:15pm</div>
        <div class="cart-icon"><i id="trash-1" class="fas fa-trash-alt"></i></div>
      </div>
       <div id="item-2" class="cart-item">
         <div class="cart-type" style="left: 263px">App</div>
        <div class="cart-item-header"> v3.2 deployed</div>
        <div class="cart-item-date">10/05/2018 :: 12:15pm</div>
         <div class="cart-icon"><i id="trash-2" class="fas fa-trash-alt"></i></div>
        
      </div>
       </section>
       <section>
        <div class="cart-date" style="left: -40px;">October 3, 2018</div>
      <div id="item-1" class="cart-item">
        <div class="cart-type">System</div>
        <div class="cart-item-header"> outage on 10/15/2018</div>
        <div class="cart-item-date">10/0/2018 :: 4:45pm</div>
        <div class="cart-icon"><i id="trash-1" class="fas fa-trash-alt"></i></div>
      </div>
   </section>
      
    </div>

    <a id="close" class="button_close" style="color: white">Close</a>
  </div> <!--end shopping-cart -->

         
 </div>
</div>

  <section class="wizard">
 <div style="font-size: 100px;">Wizard</div>
    <section>
  <h1>Notifications</h1>
  <a id="notification-trigger" onclick="setTimeout(try(), 3000);"class="button button_1" style="color: white;">Trigger notification</a> 
 </section>
<ul id="notifications-wrapper" class="notification--list">
</ul>
  </section>
</html>
              
            
!

CSS

              
                body{
  
}
/*Line CSS*/
.line{
  border-bottom: 3px solid #729ef9; /*change back to white*/
  padding-bottom: 29px;
  padding-right: 10px;
  margin-top: 20px;
  
}


.header{
  position: fixed;
  height: 100px;
  width: 100%;
  background-color: white;
  box-shadow: 0px 2px 5px lightGrey;
}

.logo{
  position: absolute;
  left: 15px;
  top: 8px;
  color: rgb(14, 86, 130);
  font-size: 50px;
  font-weight: bold;
  
}

.wizard{
  width: 100%;
  height: 600px;
  padding-top: 200px;
  background-color: rgb(242,242,242);
  text-align: center;

  box-shadow: 0px 1px 10px lightGrey;
}

.icon_container{
  position: absolute;
  top: 25px;
  right: 10px;
  font-size: 25px;
  color: rgb(14, 86, 130);
  padding: 
}

.icon{
  transition: .3s;
  cursor: pointer;
}

.icon:hover{
  /*color: orangeRed;*/
  transform: scale(1.1);
}

.bars{
  padding-left: 10px;
  border-left: 1px solid lightGrey;
  padding-top: 15px;
  padding-bottom: 15px;
}

.float {
  display: inline-block;
  transition-duration: 0.3s;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
}
.float:hover {
  transform: translateY(-5px);
}

.span{
  margin-right: 30px;
  color: grey;
  font-size: 20px;
}

i{
  margin-left: 10px;
}



.button {
  background: ;
  border-radius: 5px;
  font-weight: bold;
  color: !white;
  cursor: pointer;
  padding: .5em;
  position: absolute;
  left: 46%;
  top: 470px;
}

.notification--list {
  box-sizing: border-box;
  border-radi
  list-style: none;
  position: fixed;
  top: 110px;
  right: .5em;
  width: 400px;
  max-width: 400px;
  overflow: hidden;
  transition: all 500ms cubic-bezier(0.42, 0, 1, 1);
}
.notification--list .notification--item {
  box-sizing: border-box;
  border-radius: 5px;
  position: relative;
  padding-left: 5px;
  padding-top: 10px;
  padding-right: 20px;
  background: white;
  position: relative;
  margin-bottom: 1rem;
  max-height: 200px;
  text-align: left;
  overflow-y: hidden;
 
  box-shadow: 0px 3px 5px lightgrey;
  border-width: 1px;
  -webkit-animation: slideIn 600ms 1;
          animation: slideIn 600ms 1;

}
.notification--list .notification--item .fade-out, .notification--list .notification--item[data-state="fadeout"] {
  -webkit-animation: fadeOut 200ms 1;
          animation: fadeOut 200ms 1;
}
.notification--list .notification--item .slide-up, .notification--list .notification--item[data-state="slideup"] {
  -webkit-animation: slideUp 200ms;
          animation: slideUp 200ms;
}
.notification--list .notification--item h3 {
  margin-top: 0;
}
.notification--list .close {
  font-size: 12px;
  position: absolute;
  top: .75em;
  right: .75em;
  cursor: pointer;
  line-height: 1.2;
  padding: 3px 6px;
}

@-webkit-keyframes fadeOut {
  from {
    opacity: 1.0;
  }
  to {
    opacity: 0.0;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1.0;
  }
  to {
    opacity: 0.0;
  }
}
@keyFrames slideIn {
  from {
    -webkit-transform: translateX(300px);
            transform: translateX(300px);
    
  }
  to {
    -webkit-transform: translateX(0);
            transform: translateX(0);
  }
}
@keyFrames slideUp {
  from {
    max-height: auto;
    opacity: 0;
  }
  to {
    max-height: 0;
    padding: 0;
    margin-bottom: 0;
    opacity: 0;
    -webkit-transform: translate3d(0, -100%, 0);
            transform: translate3d(0, -100%, 0);
  }
}
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}


/*Bell Animation*/
.notification {
  width: 50px;
  height: inherit;
  color: rgb(14, 80, 136);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  content: attr(data-count);
  min-width: 20px;
  height: 20px;
}

.notification::after {
  min-width: 20px;
  height: 20px;
  content: attr(data-count);
  background-color: red;
  font-family: monospace;
  font-weight: bolt;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  position: absolute;
  top: -7px;
  right: 3px;
  transition: .3s;
  opacity: 0;
  transform: scale(.5);
  will-change: opacity, transform;
  color: white;
}

.notification.show-count::after {
  opacity: 1;
  transform: scale(1);
}

.notification::before {
  content: "\f0f3";
  font-family: "FontAwesome";
  display: block;
}

.notification.notify::before {
  animation: bell 1s ease-out;
  transform-origin: center top;
}

@keyframes bell {
	20% {
		transform: rotate(15deg);
	}
	40% {
		transform: rotate(-10deg);
	}
	60% {
		transform: rotate(5deg);
	}
	80% {
		transform: rotate(-5deg);
	}
	100% {
		transform: rotate(0deg);
	}{transform: rotate(0);}  
}


/*Notification Dropdown*/


.shopping-cart {
  margin: 35px 0;
  float: right;
  background: white;
  width: 375px;
  position: relative;
  border-radius: 3px;
  padding: 20px;
  margin-right: 83px;
  border-radius: 5px;
  box-shadow: 0px 3px 5px lightgrey;
 /*visibility: hidden;*/

}
.shopping-cart .shopping-cart-header {
  border-bottom: 1px solid #E8E8E8;
  font-weight: bold;
}
.shopping-cart .shopping-cart-header .shopping-cart-total {
  float: right;
}
.shopping-cart .shopping-cart-items {
  padding-top: 20px;
}
.shopping-cart .shopping-cart-items li {
  margin-bottom: 18px;
}
.shopping-cart .shopping-cart-items img {


}
.shopping-cart .shopping-cart-items .item-name {
  display: block;
  padding-top: 10px;
  font-size: 16px;
}
.shopping-cart .shopping-cart-items .item-price {
  color: #6394F8;
  margin-right: 8px;
}


/*Notification item*/
.cart-item{
  border-style: solid;
  border-width: 1px;
  border-color: rgb(242, 242, 242);
  background-color: white;
  border-radius: 5px;
  padding-left: 12px;
  margin-left: 0px;
  margin-bottom: 10px;
}

.cart-item:hover{
  box-shadow: 0px 2px 1px rgb(242,242,242);
  transition: .4s;
   transform: translate(0, -1px);
  transform: translate3d(0, -1px, 0);
}

.cart-item .cart-item-header{
  position: relative;
  color: rgb(80, 80, 80);
  font-size: 17px;
  font-weight: 600;
  top: -12px;
}

.cart-item .cart-item-date{
  position: relative;
  color: rgb(80, 80, 80);
  font-size: 12px;
  font-weight: 600;
  top: -10px;
}

.cart-item .cart-icon{
  position: relative;
  font-size: 12px;
  top: -22px;
  left: 290px;
  color: rgb(112, 112, 112)
}

.cart-item .cart-icon:hover{
  color: red;
  cursor: pointer;
}

.cart-item .cart-type{
  font-size: 12px;
  color: rgb(160, 160, 160);
  position: relative;
  left: 275px;
  top: 1px;
}

.cart-date{
  font-size: 14px;
  color: rgb(160, 160, 160);
  position: relative;
  left: 0px;
  top: -5px;
}

.shopping-cart:after {
  bottom: 100%;
  left: 89%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border-bottom-color: white;
  border-width: 8px;
  margin-left: -8px;
}

.cart-icon {
  color: #515783;
  font-size: 24px;
  margin-right: 7px;
  float: left;
}



.button_close {
  background: rgb(14, 80, 136);
  color: !white;
  text-align: center;
  padding-bottom: 5px;
  text-decoration: none;
  display: block;
  font-weight: bold;
  border-radius: 5px;
  padding-top: 5px;
  font-size: 15px;
  margin: 25px 60px 0 60px;
  cursor: pointer;
  font-size: 20px;
}

.button_1 {
  background:  #729ef9;
  color: white;
  text-align: center;
  padding: 10px;
  text-decoration: none;
  display: block;
  font-weight: bold;
  border-radius: 3px;
  padding-top: 10px;
  font-size: 16px;
  margin: 0px 0 15px 0;
  cursor: pointer;
}
.button:hover {
  background: #729ef9;
}

.clearfix:after {
  content: "";
  display: table;
  clear: both;
}


/*Notification Type Toggle*/

.tgl {
  display: none;
}
.tgl, .tgl:after, .tgl:before, .tgl *, .tgl *:after, .tgl *:before, .tgl + .tgl-btn {
  box-sizing: border-box;
}
.tgl::-moz-selection, .tgl:after::-moz-selection, .tgl:before::-moz-selection, .tgl *::-moz-selection, .tgl *:after::-moz-selection, .tgl *:before::-moz-selection, .tgl + .tgl-btn::-moz-selection {
  background: none;
}
.tgl::selection, .tgl:after::selection, .tgl:before::selection, .tgl *::selection, .tgl *:after::selection, .tgl *:before::selection, .tgl + .tgl-btn::selection {
  background: none;
}
.tgl + .tgl-btn {
  outline: 0;
  display: block;
  width: 4em;
  height: 2em;
  position: relative;
  cursor: pointer;
  width: 36px;
    height: 21px;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.tgl + .tgl-btn:after, .tgl + .tgl-btn:before {
  position: relative;
  display: block;
  content: "";
  width: 50%;
  height: 100%;
}
.tgl + .tgl-btn:after {
  left: 0;
}
.tgl + .tgl-btn:before {
  display: none;
}
.tgl:checked + .tgl-btn:after {
  left: 50%;
}

.tgl-light + .tgl-btn {
  background: #44EF88;
  border-radius: 2em;
  padding: 2px;
  /*transition: all .2s ease;  -- was affecting order of ops*/
}
.tgl-light + .tgl-btn:after {
  border-radius: 50%;
  background: #fff;
  transition: all .2s ease;
}
.tgl-light:checked + .tgl-btn {
  background: #44BCEF;
}

/*Clear button css*/
.clear{
  color: rgb(180, 180, 180);
  font-size: 15px;
  font-weight: 400;
  position: absolute;
  left: 290px;
  cursor: pointer;
}

.clear:hover{
  color: red;
}
              
            
!

JS

              
                var noti = document.getElementById('notification');
var bell = document.getElementById('bell');
var header = document.getElementById("header");
var header = document.getElementById("wizard");



function myFunction() {
    document.getElementById("notification").style.visibility = "visible";
    document.getElementById("header").style.opacity = .3;
    document.getElementById("wizard").style.opacity = .3;
}

function closeMe() {
    noti.style.visibility = "hidden";
    header.style.opacity = 1;
    wizard.style.opacity = 1;
}

(function () {
  var notificationsWrapper = document.getElementById('notifications-wrapper'),
      notificationButton = document.getElementById('notification-trigger');

  notificationButton.addEventListener('click', generateNotification);

  // Close Notififcation
  function closeNotification(notification) {
    var itemCount = notificationsWrapper.childElementCount,
        currentItemId = notification.getAttribute('id').split('-')[1],
        nextItem = document.getElementById('item-' + parseInt(currentItemId + 1, 10)),
        removalHeight = notification.offsetHeight;

  notification.setAttribute('data-state', 'fadeout');
    notification.addEventListener('animationend', function() {   

      notification.setAttribute('data-state', 'slideup');  
      this.addEventListener('animationend', function() {
        this.remove();
      });
    });
  }
  
  // Generate Notification
  function generateNotification() {
    $cart.style.visibility = "hidden";
      $line.style.borderBottom = "3px solid white";
    var listItemFragment = document.createDocumentFragment(),
        listItem = document.createElement('li'),
        closeButton = document.createElement('a'),
        closeButtonX = document.createElement('span'),
        closeButtonText = document.createElement('span'),
        title = document.createElement('h5'),
        message = document.createElement('p'),
        notificationCount = 0;

    closeButton.setAttribute('class', 'close');
    closeButtonX.setAttribute('aria-hidden', true);
    closeButtonX.textContent = 'X';
    closeButtonText.setAttribute('class', 'screen-reader-text');
    closeButtonText.textContent = 'close notification';

    title.textContent = 'This is a Test Notification';
    message.textContent = '10/09/2018 :: 3:13pm';

    listItem.setAttribute('id', 'item-'+ notificationsWrapper.childElementCount);
    listItem.setAttribute('class', 'notification--item');
    listItem.setAttribute('role', 'alert');
    
    closeButton.appendChild(closeButtonX);
    closeButton.appendChild(closeButtonText);
    listItem.appendChild(closeButton);
    listItem.appendChild(title);
    listItem.appendChild(message);

    // Append to doc frag(s)
    listItemFragment.appendChild(listItem);
    notificationsWrapper.appendChild(listItemFragment);

    //$(".notification--item").delay(7000).fadeOut(500);


    //setTimeout(function() { closeNotification(this, this.parentNode); }, 8000);
    // Add Events
    closeButton.addEventListener('click', function() {
      closeNotification.call(this, this.parentNode);
    });
    
    
  }
})();


// Bell animation from yours truly -- Landon
const $button = document.getElementById('notification-trigger');
const $bell = document.getElementById('notification');
const $cart = document.getElementById('cart');
const $line = document.getElementById('line');

$button.addEventListener("click", function(event){
  const count = Number($bell.getAttribute('data-count')) || 2;
  
  $bell.setAttribute('data-count', count + 1);
  $bell.classList.add('show-count');
  $bell.classList.add('notify');
});

$bell.addEventListener("animationend", function(event){
  $bell.classList.remove('notify');
});

setTimeout(function() {
   const count = Number($bell.getAttribute('data-count')) || 2;
 
  $bell.classList.add('show-count');
  $bell.classList.add('notify');
}, 1000);


window.onload = function() {
   const count = Number($bell.getAttribute('data-count')) || 1;
  $bell.setAttribute('data-count', count + 1);
  $bell.classList.add('show-count');
 // $cart.style.visibility = "hidden";
};


//Notification Tray
(function(){
 
  $("#notification").on("click", function() {
    if($('.shopping-cart').is(':visible')){
      $(".shopping-cart").fadeToggle( "fast");
      $cart.style.visibility = "hidden";
      $line.style.borderBottom = "3px solid white";
    }
    else if($('.shopping-cart').is(':hidden')){
      $(".shopping-cart").fadeToggle( "fast");
      $cart.style.visibility = "visible";
      $line.style.borderBottom = "3px solid #729ef9";
    }
    
  
    
  });
  
 
  
})();


(function(){
 
  $("#close").on("click", function() {
    if($('.shopping-cart').is(':visible')){
      $(".shopping-cart").fadeToggle( "fast");
      $cart.style.visibility = "hidden";
      $line.style.borderBottom = "3px solid white";
    }
    else if($('.shopping-cart').is(':hidden')){
      $(".shopping-cart").fadeToggle( "fast");
      $cart.style.visibility = "visible";
      $line.style.borderBottom = "3px solid lightGreen";
    }

  });
  
 
  
})();


// If checkbox is click -- change color and font-weight 
$('#cb1').click(function(){
    if (this.checked) {
        $('#rec').css('color', 'rgb(180, 180, 180)')
        $('#rec').css('font-weight', '400')
        $('#type').css('color', 'rgb(14, 80, 136)')
        $('#type').css('font-weight', 'bold')
    }
    else{
      $('#rec').css('color', 'rgb(14, 80, 136)')
        $('#rec').css('font-weight', 'bold')
        $('#type').css('color', 'rgb(180, 180, 180)')
        $('#type').css('font-weight', '400')
    }
}) 

$('#trash-1').click(function(){
        $('#item-1').css('display', 'none')
}) 



$('#trash-2').click(function(){
        $('#item-2').css('display', 'none')
}) 


              
            
!
999px

Console