【发布时间】:2014-01-09 09:47:21
【问题描述】:
我在(滚动的)iframe 中有一个可拖动的 div 时遇到了麻烦。请看看这个小提琴:http://jsfiddle.net/CqE43/
这是使用的代码:
$('#test').contents().find('body').append('<div id="wrapper" style="width: 300px; height: 900px; background: #ff0000; display: block; margin-top:50px;"><div id="drag" style="width: 100px; height: 100px; background-color: blue;" ></div></div>');
$('#test').contents().find('#drag').draggable({
iframeFix: true,
start: function( event, ui ) {
console.log('start');
},
drag: function( event, ui ) {
console.log('drag');
},
stop: function( event, ui ) {
console.log('stop');
}
});
奇怪的行为是:如果 iframe 没有滚动,一切都会按预期工作,但如果稍微滚动 iframe,拖动时会出现偏移。
【问题讨论】:
-
还有一件奇怪的事情:一旦完成拖动,我就不会进入停止方法
-
还有一个:滚动条向右移动后无法拖动..(可能与上述有关)
-
jep,对我来说也一样......但这可能与 jsfiddle 有关。但我很肯定我所说的其他行为也发生在其他用例中。
标签: javascript jquery iframe