Jquery draggable with bootstrap modal, scroller strange behaviour

Maris

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
        $(element).draggable({
            handle: ".modal-header"
        });

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

Bass Jobsen

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

  
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div>
<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>
      <div class="modal-body">
        <p>One fine body&hellip;</p>
      </div>
      <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>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal --> 
</div>

<script>
        $('.modal').modal({ keyboard: false,
                           show: true
        });
        // Jquery draggable
        $('.modal-dialog').draggable({
            handle: ".modal-header"
        });
</script>  

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

具有Bootstrap布局的jQuery UI Draggable

来自分类Dev

具有Bootstrap布局的jQuery UI Draggable

来自分类Dev

jQuery Draggable with Bootstrap Tooltip TypeError: e.$element is null

来自分类Dev

Jquery datepicker & Bootstrap modal Error in (Firefox)

来自分类Dev

Twitter Bootstrap 3 Modal中的jQuery Datepicker

来自分类Dev

Twitter Bootstrap 3 Modal中的jQuery Datepicker

来自分类Dev

#Bootstrap 3.2.0#modal-dialogs #jquery

来自分类Dev

调用后 JQuery Bootstrap Modal 未关闭

来自分类Dev

Strange Chrome image resizing behaviour

来自分类Dev

jQuery Draggable投掷错误

来自分类Dev

jQuery Draggable禁用样式

来自分类Dev

Bootstrap Modal中的jQuery验证不起作用

来自分类Dev

jQuery UI不适用于bootstrap 3 modal

来自分类Dev

Bootstrap jQuery Modal在按钮单击时未加载

来自分类Dev

jQuery UI不适用于bootstrap 3 modal

来自分类Dev

无法将数据从PHP + JQuery加载到Bootstrap 3 Modal

来自分类Dev

BootStrap Django Jquery Modal在Ajax调用提交时未关闭

来自分类Dev

在php echo和JQuery .load中的bootstrap modal

来自分类Dev

火jQuery函数后如何显示Bootstrap Modal

来自分类Dev

JQuery Bootstrap Modal 自动计算文本字段不更新

来自分类Dev

File/FileInputStream relative path strange behaviour

来自分类Dev

Strange java behaviour with conditional operator. Is it a bug?

来自分类Dev

jQuery UI Draggable:点击堆叠

来自分类Dev

溢出容器中的jQuery Draggable

来自分类Dev

旋转.draggable()div-JQuery

来自分类Dev

jQuery UI Draggable on droppable元素

来自分类Dev

jQuery UI .draggable和Chrome

来自分类Dev

溢出容器中的jQuery Draggable

来自分类Dev

jQuery Scroller到达终点后需要停止滚动