Я бы посоветовал вместо использования jQuery - или любого другого JavaScript - рассмотреть возможность использования CSS-анимации;хотя основанный на процентах ключевой кадр может быть немного неточным:
#mybox {
/* taking the element out of the document flow: */
position: absolute;
/* positioning the element on-screen to start: */
top: 0.5em;
/* this is the shorthand, and equivalent to:
animation-duration: 60s;
animation-timing-function: linear;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-name: notificationPopup; */
animation: 60s linear 0s infinite notificationPopup;
}
@keyframes notificationPopup {
/* the animation can modify multiple properties,
but since the only property we need to modify
in order to have it appear/disappear is the
'transform' property, that's all we change: */
0% {
/* the first keyframe, we maintain the position: */
transform: translateY(0);
}
16.3% {
/* 16.6% is about ten seconds of the 60s (60 seconds/1 minute),
here we ensure the animation between visible and hidden doesn't
occur too soon by creating another keyframe 0.3 seconds
beforehand: */
transform: translateY(0);
}
16.6% {
/* here, at approximately the ten-second mark, we create a keyframe
that hides the element (moving it out of the viewport): */
transform: translateY(-120%);
}
99.7% {
/* because we show the element at 0%, we again create a keyframe
0.3s before that point, to prevent premature movement: */
transform: translateY(-120%);
}
}
@import url('https://fonts.googleapis.com/css?family=Roboto');
*,
::before,
::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
font-size: 1rem;
color: #000;
font-family: Roboto, Calibri, Helvetica, Arial, sans-serif;
}
#mybox {
position: absolute;
top: 0.5em;
left: 10vw;
width: 80vw;
border: 2px solid limegreen;
padding: 0.5em;
border-radius: 1em;
background-color: #fff;
box-shadow: 0 0 15px 5px #666;
animation: 60s linear 0s infinite notificationPopup;
}
@keyframes notificationPopup {
0% {
transform: translateY(0);
}
16.3% {
transform: translateY(0);
}
16.6% {
transform: translateY(-120%);
}
99.7% {
transform: translateY(-120%);
}
}
<div id="mybox">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum, tempora esse laudantium officiis rerum! Quas enim, ratione, repellendus est natus doloribus rerum, maiores harum nisi modi cupiditate, a? Pariatur, quam.</div>
<section>
<h1>Page title</h1>
<p>section content</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci accusantium, sint veritatis nulla odit perspiciatis quos, distinctio maxime deleniti. Distinctio, aut officia, ad dolorum consequatur neque nemo! Quas, tempore sapiente.</p>
</section>
JS Fiddle demo .
Ссылки: