自定义消息提示框

<!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就是去那下载的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值