我想讓緩存記住用戶是否關閉了div。我怎樣才能做到這一點?我可以關閉div,但是當頁面刷新時,它不會被保存。有沒有辦法做到這一點?記住用戶是否關閉div
現場查看:http://eldeskin.com
HTML:
<div id="ps"><div class="close">
<button onClick="document.getElementById('ps').style.display = 'none';">x</button></div>
<div id="heart"></div><div class="text">PSSSST!<br><br>Følger du oss på <br><a target="_blank" href="http://instagram.com/eldeskincare">Instagram</a> og <a target="_blank" href="http://facebook.com/eldeskin">Facebook</a>?</div></div>
CSS:
#ps {
position: fixed;
bottom: 30px;
right: 30px;
border: 1pt solid #000;
padding: 20px;
text-align: center;
text-transform: uppercase;
z-index: 99;
background: #FFF;
width: 300px;
}
#ps .text {
position: relative;
top: -30px;
}
#ps .text a {
font-size: 14px;
text-decoration: none;
color: #c19426;
font-weight: 500;
letter-spacing: 1px;
}
#ps .close {
text-align: right !important;
}
#ps .close button {
border: none;
font-size: 20px;
font-weight: 100;
font-family: Raleway;
background: none;
}
#heart {
position: relative;
top: 94px;
left: 135px;
border-bottom: 1pt solid #000;
border-right: 1pt solid #000;
background: #FFF;
color: #FFF;
z-index: 6;
width: 30px !important;
height: 30px !important;
transform: rotate(45deg);
-ms-transform: rotate(45deg); /* IE 9 */
-webkit-transform: rotate(45deg); /* Safari and Chrome */
}
請不要鏈接到你的網站。這是爲什麼:http://meta.stackexchange.com/questions/125997/something-in-my-web-site-or-project-doesnt-work-can-i-just-paste-a-link-to-it –
有沒有這樣的事情記住緩存,它可以是餅乾,本地存儲或serverside保持國家。 – adeneo
localstorage是你的朋友 – epascarello