在js中绑定方法

$(document).on("show.bs.modal", ".modal", function(){
    $(this).draggable({
//        handle: ".modal-header"   // 只能点击头部拖动
    });
    $(this).css("overflow", "hidden"); // 防止出现滚动条,出现的话,你会把滚动条一起拖着走的
});

bootstrap modal 的events:
查了好久才查到:(

事件描述示例
show.bs.modal在调用 show 方法后触发。 $("#identifier").on('show.bs.modal', function(){//do sth. });
show.bs.modal当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。 $("#identifier").on('shown.bs.modal', function(){//do sth. });
hide.bs.modal当调用 hide 方法时触发。 $("#identifier").on('hide.bs.modal', function(){//do sth. });
hidden.bs.modal当模态框完全对用户隐藏时触发。 $("#identifier").on('hidden.bs.modal', function(){//do sth. });

详细参考:http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html

Logo

Agent 垂直技术社区,欢迎活跃、内容共建,欢迎商务合作。wx: diudiu5555

更多推荐