HTML代码:
<!-- 弹窗 -->
<div class="modal fade" id="modal_20200114" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">公告</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
内容 </div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" id="modal_20200114_lock">我知道了,不要再弹出</button>
</div>
</div>
</div>
</div>
JS代码:(放到底部)
<script>
!function (){
var a = $('#modal_20200114');
var b = $('#modal_20200114_lock');
var k = $.cookie('modal_20200114_lock');
if(!k){
a.modal('show');
b.on('click', function() {
$.cookie('modal_20200114_lock', '1');
});
}
}();
</script>