<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>自定义提示弹出框</title>
<link rel="stylesheet" href="../css/hover.css" type="text/css"/>
<script src="../js/jquery-3.3.1.min.js.js"></script>
<style>
.the-message-div{
position:fixed;
top:20%;
width:100%;
height:30px;
line-height:30px;
margin-top:-15px;
vertical-align: middle;
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-animation-name: hvr-wobble-vertical;
animation-name: hvr-wobble-vertical;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: 1;
animation-iteration-count: 1;
}
.the-message-p{
line-height: 1.5em;
background:#000;
opacity:0.8;
color:#fff;
text-align:center;
padding:10px 10px;
margin:0 auto;
font-size:12px;
border-radius:4px;
}
</style>
</head>
<body>
<input type="button" value="复制" onclick="tankuang('200','看这里','2000');"/>
<script>
function tankuang(pWidth,content,time) {
$("#msg").remove();
var html ='<div id="msg" class="the-message-div"><p class="the-message-p" style="width:'+ pWidth +'px;">'+ content +'</p></div>'
$("body").append(html);
var t=setTimeout(next,time);
function next() {
$("#msg").remove();
}
}
</script>
</body>
</html>
关于提示框的出场动作可以自己去做,这里我是去这个网址http://wow.techbrood.com/fiddle/852将特效给弄下了,这一点一百个人有一百种方法,上面代码用的hover.js就是去那下载的