first of all, I know that a similar question has been answered before but I really don't get it, I am a nub at jquery right now and I am really not sure how to implement this on my code or get how it works.
(首先,我知道之前已经回答过类似的问题,但我确实不知道,我现在在jquery上还是个小菜一碟,我真的不确定如何在我的代码上实现它或如何工作。)
If someone could not only give me the solution but also explain what it does and how that would be fantastic.(如果有人不仅可以给我解决方案,还可以解释它的作用,那将是多么美妙。)
So here is my HTML
(这是我的HTML)
<div id="cookieConsent">
This website is using cookies. <a href="#" target="_blank">More info</a>.<a class="cookieConsentOK">That's Fine</a>
</div>
Obviously I have my script file linked and the jquery CDN aswell so no need to show that, now here is my css for it.
(显然,我已链接了脚本文件和jquery CDN,因此无需显示,现在是我的CSS。)
/*Cookie Consent Begin*/
#cookieConsent {
background-color: rgba(20,20,20,0.8);
min-height: 26px;
font-size: 14px;
color: #ccc;
line-height: 26px;
padding: 8px 0 8px 30px;
font-family: "Trebuchet MS",Helvetica,sans-serif;
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: none;
z-index: 9999;
text-align: center;
}
#cookieConsent a {
color: #4B8EE7;
text-decoration: none;
}
#closeCookieConsent {
display: inline-block;
cursor: pointer;
height: 20px;
width: 20px;
margin: -15px 0 0 0;
font-weight: bold;
}
#closeCookieConsent:hover {
color: #FFF;
}
#cookieConsent a.cookieConsentOK {
background-color: #4B8EE7;
color: white;
display: inline-block;
border-radius: 5px;
padding: 0 20px;
cursor: pointer;
margin: 0 60px 0 10px;
transition: background-color 650ms;
}
#cookieConsent a.cookieConsentOK:hover {
background-color: #3e75bd;
}
/*Cookie Consent End*/
And finally my working but annoying jquery js file
(最后是我工作但烦人的jQuery js文件)
$(document).ready(function(){
setTimeout(function () {
$("#cookieConsent").fadeIn(700);
}, 1000);
$(".cookieConsentOK").click(function() {
$("#cookieConsent").fadeOut(700);
});
});
If someone could help me with making the pop up only show once per IP or user session(and I mean like till they close their browser completely, trying to focus on mobile as well) and not only provide me with a solution but also explain it, I WOULD LOVE YOU!
(如果有人可以帮助我使弹出窗口在每个IP或用户会话中仅显示一次(我的意思是说直到他们完全关闭浏览器,然后尝试着眼于移动设备),并且不仅向我提供解决方案,而且还要向我解释,我会爱你!)
ask by KrapnixTheFootballer translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…