bootstrap弹出多个模态框_扩展bootstrap的modal模态框-动态添加modal框-弹出多个modal框...

js代码

0){

modal.remove();

initView();

}

}

/**打开modal*/

function openModal(event){

// var this = $(this);

var $this = $(event.currentTarget);

var _url = $this.attr("href");

var _title = $this.attr("title");

var _id;

_id = dialog.content();

var options = {

backdrop: false,keyboard: true,show: true

};

$('#' + _id).modal(options);

var modal = $('#' + _id);

if(typeof(_title) != "undefined"){

if(modal.find('.modal-title').length <= 0){

var header = dialog.header({title : _title});

$($.parseHTML(header)).appendTo(modal.find(".modal-content"));

}else{

modal.find('.modal-title').text(_title);

}

if(modal.find('.modal-body').length <= 0){

var _body = dialog.body;

$($.parseHTML(_body)).appendTo(modal.find(".modal-content"));

}

modal.find(".modal-body").load(_url,$.proxy(function () {

modal.trigger('loaded.bs.modal');

initView();

},this));

}else{

modal.find(".modal-content").load(_url,this));

}

//阻止事件默认行为

event.preventDefault();

}

//modal model

//TO STRAT

if(!$(window).data("_modal_id")){

$(window).data("_modal_id",0);

}

var dialog = {

header : function(options){

var template = '

'

+ '

'

+'';

return template;

},content : function(){

var _modal_id = $(window).data("_modal_id");

var _id = "_modal_id_" + _modal_id;

_modal_id ++;

$(window).data("_modal_id",_modal_id);

var template = '

'

+ ''

+'';

$(template).appendTo('body');

initView();

return _id;

},body : '

'

};

//TO END

页面代码:

title="请选择用餐类型">签到

页面上只要在a标签后加上target="dialog",并且提供href外部链接地址就可以弹出modal框

以上所述是小编给大家介绍的扩展bootstrap的modal模态框-动态添加modal框-弹出多个modal框。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值