实现右下角广告图片的弹出
代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>广告</title>
<style type="text/css">
img {
width: 200px;
height: 200px;
display: none;
/*固定定位,定位参照物为浏览器的可视化窗口*/
position: fixed;
right: 10px;
bottom: 10px;
}
</style>
</head>
<body>
<img src="img/img04.jpg" alt="" />
</body>
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
setInterval(function(){
/*
总共4000
花500毫秒执行显示的动画
显示完保持1500毫秒
在第2000毫秒时执行隐藏的动画,耗时500毫秒
隐藏保持1500毫秒
*/
$("img").slideUp(500,"linear");
setTimeout(function(){
$("img").slideDown(500,"linear");
},2000)
},4000)
</script>
</html>
showtime: