layer.js中怎样设置点击a标签后弹层自己关闭后后再自行跳转页面_百度...
发布网友
发布时间:2022-04-23 06:11
我来回答
共1个回答
热心网友
时间:2022-04-07 11:17
直接用cdn写个实例
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/2.1.2/jquery.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/layer/3.0.3/layer.min.js"></script>
</head>
<style>
.link {
color: #0a8ddf;
cursor: pointer;
}
</style>
<script>
layer.open({
title: '测试',
content: '<a class="link">点击关闭跳转</a>',
success: function (layero, index) {
$(layero).find('.link').click(function () {
layer.close(index);
window.location.href = 'http://www.baidu.com/'
})
}
})
</script>
</html>