欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

Bootstrap自定义confirm提示效果实例分享

程序员文章站 2023-12-25 21:04:51
...
本文主要和大家详细介绍集合Bootstrap自定义confirm提示效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。

效果

这里写图片描述

js端


var Common = {
  confirm:function(params){
    var model = $("#common_confirm_model");
    model.find(".title").html(params.title)
    model.find(".message").html(params.message)

    $("#common_confirm_btn").click()
    //每次都将监听先关闭,防止多次监听发生,确保只有一次监听
    model.find(".cancel").die("click")
    model.find(".ok").die("click")

    model.find(".ok").live("click",function(){
      params.operate(true)
    })

    model.find(".cancel").live("click",function(){
      params.operate(false)
    })
  }
}

html端


<input type="hidden" id="common_confirm_btn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#common_confirm_model">
<p id="common_confirm_model" class="modal">
  <p class="modal-dialog modal-sm">
    <p class="modal-content">
      <p class="modal-header">
        <button type="button" class="close" data-dismiss="modal">

    <span aria-hidden="true">×</span>

    <span class="sr-only">Close</span></button>
        <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> 

       <span class="title"></span>

    </h5>
      </p>
      <p class="modal-body small">
        <p ><span class="message"></span></p>
      </p>
      <p class="modal-footer" >
        <button type="button" class="btn btn-primary ok" data-dismiss="modal">确认</button>
        <button type="button" class="btn btn-default cancel" data-dismiss="modal">取消</button>
      </p>
    </p>
  </p>
</p>

调用


Common.confirm({
   title: "标题",
   message: "内容",
   operate: function (reselt) {
     if (reselt) {
       ........
     } else {
       ........
     }
   }
 })

相关推荐:

jquery表单验证仿Toast提示效果实例分享

jquery模拟title提示效果

jquery php 百度搜索框智能提示效果_PHP教程

以上就是Bootstrap自定义confirm提示效果实例分享的详细内容,更多请关注其它相关文章!

上一篇:

下一篇: