集合Bootstrapカスタムconfirm

5935 ワード

効果
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)
        })
    }
}
両端
type="hidden" id="common_confirm_btn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#common_confirm_model">
"common_confirm_model" class="modal">
class="modal-dialog modal-sm">
class="modal-content">
class="modal-header">
class="modal-title">class="fa fa-exclamation-circle"> class="title">
class="modal-body small">

class="message">

class="modal-footer" >
呼び出し
Common.confirm({
      title: "  ",
      message: "  ",
      operate: function (reselt) {
          if (reselt) {
              ........
          } else {
              ........
          }
      }
  })