前端技术(2) : 1秒后消失的提示框

需引入 jQuery, 下载 jquery-1.11.3.min.js

 

图标下载

 

 

css

 

.i_class-alert {
				width: 30px;
				height: 30px;
				display: inline-block;
				margin-top: -5px;
				background: url(http://hbkj-pc-web-img.oss-cn-beijing.aliyuncs.com/pru_bb_icon.png) -6px -7px no-repeat;
				vertical-align: middle;
			}
			
			.dp-model-alert {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				z-index: 9999;
				display: none;
			}
			
			.content-alert {
				width: 450px;
				height: 150px;
				background: #fff;
				position: fixed;
				top: 50%;
				left: 45%;
				margin-left: -75px;
				margin-top: -320px;
				border: 5px solid #ccc;
			}
			
			.content-top-alert {
				height: 30px;
				background: #f8f8f8;
				padding: 0 7px;
			}
			
			.left-alert {
				line-height: 30px;
				float: left;
			}
			
			.right-close-alert {
				float: right;
				line-height: 30px;
				cursor: pointer;
			}
			
			.content-bottom-alert {
				height: 120px;
				position: relative;
			}
			
			.content-bottom-c-alert {
				width: 270px;
				height: 40px;
				position: absolute;
				top: 30%;
				left: 5%;
			}
			
			.i-alert {
				width: 30px;
				height: 30px;
				display: inline-block;
				margin-top: -5px;
				background: url(http://hbkj-pc-web-img.oss-cn-beijing.aliyuncs.com/pru_bb_icon.png) -6px -7px no-repeat;
				vertical-align: middle;
			}
			
			.span-alert {
				line-height: 40px;
				margin-left: 10px;
				font-size: 16px;
			}
			
			.content-btn-alert {
				width: 125px;
				height: 40px;
				background: red;
				position: absolute;
				top: 30%;
				right: 5%;
				color: #fff;
				line-height: 40px;
				text-align: center;
				cursor: pointer;
			}
			
			.a-alert {
				text-decoration: none;
				color: #fff;
				font-size: 12px;
			}

 

js

 

function show_1_sen() {
	$('.dp-model-alert').show().delay(1000).hide(200);//1000 表示展示1秒后消失
};

function hide_p() {
	$('.dp-model-alert').hide()
};

 

 

html

 

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src='../jquery-1.11.3.min.js'></script>
		<script type="text/javascript" src="popup.js" ></script>
		<link rel="stylesheet" href="popup.css" />
	</head>

	<body>
		<button class='collect-btn' onclick="show_1_sen()">点击收藏</button>
		<div class='dp-model-alert'>
		<div class='content-alert'>
			<div class='content-top-alert'>
				<span class='left-alert span-alert'>温馨提示</span> <span
					class='right-close-alert span-alert' onclick="hide_p()">✖</span>
			</div>
			<div class='content-bottom-alert'>
				<div class='content-bottom-c-alert'>
					<i class="i-alert"></i> <span
						class='text-content1-alert span-alert'>收藏成功 </span>
				</div>
				<a class="a-alert" href="/myhb/myCollection/000/produce">
					<div class='content-btn-alert'>查看收藏></div>
				</a>
			</div>
		</div>
	</div>
	</body>


</html>


 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值