Вы также можете сделать это чистый CSS с помощью селектора :target
и простого animation
:
#note {
width: 300px;
position: fixed;
top: 0;
left: 50%;
background: #ccc;
padding: 10px;
height: 100px;
margin: -50px 0 0 -150px;
opacity: 0;
transition: all 1s;
}
#note:target {
top: 50%;
animation: fadeOut 6s forwards;
}
@keyframes fadeOut {
16.67%, 83.33% {opacity: 1}
100% {opacity: 0}
}
<a href="#note"><button class="notify">click here</button></a>
<div id="note">Lorem Ipsum is simply dummy text of the printing and typesetting industry. </div>
Но единственным ограничением является то, что он может работать только один раз.