0
我想創建一個模式揭示,打開頁面加載與Zurb基金會6.我還想爲瀏覽器存儲一個cookie,以便如果用戶關閉顯示它不會再打擾他們7天。基金會6揭示在頁面加載與餅乾不工作
我使用的cookie jQuery插件發現here
這裏是我的html:
<div class="reveal" id="exampleModal1" data-reveal>
<h1>Awesome. I Have It.</h1>
<p class="lead">Your couch. It is mine.</p>
<p>I'm a cool paragraph that lives inside of an even cooler modal. Wins!</p>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
正如你可以看到我沒有數據,開放式的元素,因爲我想的模式來一旦頁面加載打開。
這裏是我的jQuery:
jQuery(document).ready(function($) {
if ($.cookie('modal_shown') === null) {
$.cookie('modal_shown', 'yes', { expires: 7, path: '/' });
$("#exampleModal1").foundation('reveal', 'open');
}
});
jQuery的是,在不衝突模式。
但是,這似乎並沒有工作。我沒有通過我的開發者控制檯在Chrome中發現任何錯誤。我真的很感謝幫助。