Twitter Bootstrap Modal Form: How to drag and drop?

后端 未结 4 604
面向向阳花
面向向阳花 2020-12-08 00:49

I would like to be able to move around (on the greyed-out background, by dragging and dropping) the modal form that is provided by Bootstrap 2. Can anyone tell me what the b

4条回答
  •  离开以前
    2020-12-08 01:14

    The bootstrap doesn't come with any dragging and dropping functionality by default, but you can add a little jQuery UI spice into the mix to get the effect you're looking for. For example, using the draggable interaction from the framework you can target your modal ID to allow it to be dragged around within the modal backdrop.

    Try this:

    JS

    $("#myModal").draggable({
        handle: ".modal-header"
    });
    

    Demo, edit here.

    Update: bootstrap3 demo

提交回复
热议问题