make bootstrap twitter dialog modal draggable

后端 未结 9 2217
野性不改
野性不改 2021-01-30 08:43

I\'m trying to make bootstrap twitter dialog modal draggable with this jquery plugin:

http://threedubmedia.com/code/event/drag#demos

but it doesn\'t work.

<
9条回答
  •  情话喂你
    2021-01-30 09:13

    Like others said, the simpliest solution is just call draggable() function from jQuery UI just after showing modal:

    $('#my-modal').modal('show')
                  .draggable({ handle: ".modal-header" });
    

    But there is a several problems with compatibility between Bootstrap and jQuery UI so we need some addition fixes in css:

    .modal
    {
        overflow: hidden;
    }
    .modal-dialog{
        margin-right: 0;
        margin-left: 0;
    }
    .modal-header{      /* not necessary but imo important for user */
        cursor: move;
    }
    

提交回复
热议问题