【发布时间】:2012-09-16 07:40:10
【问题描述】:
我正在尝试使用这个 jquery 插件使引导 twitter 对话框模式可拖动:
http://threedubmedia.com/code/event/drag#demos
但它不起作用。
var $div = $('html');
console.debug($('.drag'));
$('#modalTest')
.drag("start", function(ev, dd) {
dd.limit = $div.offset();
dd.limit.bottom = dd.limit.top + $div.outerHeight() - $(this).outerHeight();
dd.limit.right = dd.limit.left + $div.outerWidth() - $(this).outerWidth();
})
.drag(function(ev, dd) {
$(this).css({
top: Math.min(dd.limit.bottom, Math.max(dd.limit.top, dd.offsetY))
, left: Math.min(dd.limit.right, Math.max(dd.limit.left, dd.offsetX))
});
});
你知道我该怎么做吗?
【问题讨论】:
-
stackoverflow.com/questions/12591597/… 使用 JQuery UI
-
以下答案都不是很好,因为bootstrap conflicts with jQuery UI。
-
@AndrewMao,见stackoverflow.com/questions/12591597/…。
-
@AndrewMao 我的回答是只使用 jQuery,没有插件。见:stackoverflow.com/a/51824269/1914034
标签: jquery twitter-bootstrap modal-dialog draggable