javascript - 使用Bootstrap单击“我同意”后如何使栏消失
问题描述
在此处输入图像描述有谁知道如何在单击“我同意”后使该栏消失?我一直在寻找引导程序,但找不到解决方案。请帮忙。下面是我的代码:
<div id="cookie-message" class="cookie-message notification center-horizontal bottom static enable">
<div class="strip color-ash" >
<span class="show-tablet">We use cookies to deliver our services.</span>
By using our website, you agree to the use of cookies as described in our
<a class="color-oil" href="/assets/static/downloads/privacy-policy.pdf" target="_blank">Privacy Policy</a> —&nbsp; <a tabindex="0" href="#" class="cm-close color-deepblue">I Agree</a>
</div>
</div>
解决方案
由于您使用的是 Bootstrap,请尝试使用 jQuery:
$('.color-oil').on('click', function() {
$('#cookie-message').hide()
})
- 您正在向链接添加点击事件侦听器
- 当点击发生时,我们得到 div 并调用 hide 方法。
请让我知道这对你有没有用。
推荐阅读
- php - 路由没有参数
- java - 如何解决“无法识别的字段”问题?
- cypress - 赛普拉斯路由修改 URL 并传递某些参数
- function - 我的函数返回一个结构;为什么编译器不允许分配给该结果值的字段?
- javascript - 显示 AngularJS 中溢出的字数
- ios - UITableView 键盘外观上的自动滚动问题
- python - 在 tensorflow 2.0 中加载 tfrecord 文件时出错
- ajax - Flask:单击按钮时,将变量从 Javascript 传递到 Flask
- html - 如何有条件地为 OPENING 和 CLOSING 标签呈现 DIV 和 REACT 组件?
- java - 如何打印更大的 unicode 字符