弹窗广告代码分享

Lv.2 22SS 2022-5-12 3455

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>​
──── 0人觉得很赞 ────
最新回复 (3)
  • Lv.1 neticn 2022-5-29
    0 2
    好的
  • Lv.2 geruixi 2022-8-24
    0 3
    可以做成插件,这代码    搞不懂
  • Lv.1 zzr 2022-8-30
    0 4
    感谢分享
返回