yakın eylem hatırlamak var. Sanırım bu bilgiyi bir çerezde saklamak zorundayım. İdeal olarak, bu çerez sadece o mevcut oturum için sürecek ve geri döndükten sonra kutu tekrar görünecektir., uyarı kutusu Kullanıcıların kapatma düğmesini tıkladığında hatırlayan bir Bootstrap uyarı kutusu oluşturmak çalışıyorum
Ben jQuery Çerez eklentisi kullanıyorum. /jquery-cookie-master
'a yükledim. Eklenti found here olabilir.
Bu benim kod found here takip ederek bugüne kadar ne var olduğunu.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/jquery-cookie-master/jquery.cookie.js"></script>
<script>
function runOnLoad(){
if($.cookie('alert-box') == null) {
$.cookie('alert-box', 'open', { expires: 7 });
} else if($.cookie('alert-box') == 'close') {
$(".close").hide();
}
</script>
HTML:
<body onload="runOnLoad()">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert" href="hideMe.php" onclick="hideMe()">×</button>
<p>
<strong>FORUM UPGRADE:</strong> In light of our recent surge in popularity we upgraded our forum and unfortunately lost all the old threads in the process.
</p>
<p>
In an effort to kick-start the forum again we need your help. Sign up now and leave a post (it's free). Once we reach 100 threads every member will receive a special gift.
</p>
<p>
<a href="http://example.com/forum/#/entry/register">
<strong>Sign up to the forum now</strong>
</a>.
</p>
</div>
</body>
Ne yazık ki ben, söz konusu işlemin hatırlamaz kapatma düğmesini tıklayın ve ben sayfayı yenileyin eğer uyarı kutusu tekrar görünür working.When değil.
Neyi yanlış yaptım?
Can
jQuery aşağıdaki kodu kullanabilirsiniz kullanarak etkinlik bağlamak için kimse yardım eder? – bennygill