【发布时间】:2016-05-22 09:59:23
【问题描述】:
我已经编写了代码来制作一个可拖动的 div。结果是:我可以在屏幕上移动 div,但无法使用滚动条查看 div 内的内容。示例代码为:
HTML 代码:
<div class="draggable">
<h2>This will drag the div</h2>
<div class="scroll">This won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag
the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the divThis won't drag the div</div>
</div>
Javascript 代码:
$(document).ready(function() {
$('.draggable').draggable({
scroll: true});
});
CSS 代码:
.scroll
{
width: 100px;
height: 80px;
overflow: auto;
}
问题是:当我尝试向下滚动查看更多文本时,它也会随着光标移动 div。这让我无法看到 div 中的隐藏内容。
Jsfiddle 示例:http://jsfiddle.net/SswbX/90/
注意:这个问题只发生在 Firefox 浏览器上
我想要的是使用滚动条查看 div 内的内容。
【问题讨论】: