我使用引導模式在我的網站上展示我的特別優惠。但是每次頁面刷新時都會彈出此模式。如何限制此模式只出現一次?限制引導模式
<!-- Modal start-->
<div class="container">
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">/* header part */
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">/* Body part */
Some text
</div>
</div>
<div class="modal-footer">/* Footer part */
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>` This is the code used for the modal. What change do i need to make to make the modal pop up just once , rather than appearing on every page refresh??`
</div>
<script>
$(document).ready(function(){
$("#myModal").modal();
});
</script>
使用cookie和存儲,是彈出窗口顯示。檢查cookie。 – vaso123
使用cookie或本地存儲 –
默認情況下,每次頁面加載時都會調用文檔就緒功能,這就是每次刷新頁面時都會彈出模式的原因。 –