Maris Maris - 1 year ago 243
Javascript Question

Jquery draggable with bootstrap modal, scroller strange behaviour

I'm trying to use bootstrap modal popup with jquery-ui draggable functionality.
I use it like this:

// Bootstrap modal
$(element).modal({ keyboard: false,
show: value
// Jquery draggable
handle: ".modal-header"

But when I try to drag the popup right scroller is dragging with popup.
Thx for any advance.

Answer Source

i think you should apply draggable on the .modal-dialog class, see:

<link href="//" rel="stylesheet"/>
<script src="//"></script>
<script src="//"></script>

<script src="//"></script>
<div class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">Modal title</h4>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal --> 

        $('.modal').modal({ keyboard: false,
                           show: true
        // Jquery draggable
            handle: ".modal-header"

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download