【发布时间】:2022-01-29 16:52:47
【问题描述】:
得到这个 cookie 条:
HTML:
<div id="cookie-bar-bottom" class="cookie-bar">text...
<a href="index-cookies.html" class="cookie-policy">
<b><text style="color: rgb(230,0,100)">Cookies</text></b>
</a>
<input id="cookie-hide" class="cookie-hide" onclick="this.parentNode.parentNode.style.display = 'none'" value="Agree" type="button">
</div>
CSS:
.cookie-bar {
position: fixed;
width: 100%;
bottom: 0;
right: 0;
left: 0;
height: 30px;
text-align: center;
line-height: 25px;
background: rgb(0,140,250,1);
color: white;
font-size: 17px;
font-weight: 100;
transition: .8s;
animation: slideIn .8s;
}
我可能需要更好的解决方案,可能通过 JS 来防止下次刷新时弹出 cookie 栏。理想情况下,浏览器缓存会记住此 cookie 已被同意,因此不会再出现在该浏览器中。
有人帮我吗? 谢谢。
【问题讨论】:
标签: javascript cookies