Jquery 使用可拖动div禁用滚动
我有一个可以拖动的潜水器。当我把它拖近网页的一个边缘时,整个网站就会滚动。我可以禁用这个功能吗? (我基本上可以使用div在网页上移动,但我希望它仅限于我当前所在的位置) 我使用jquery可拖动脚本 标题:Jquery 使用可拖动div禁用滚动,jquery,scroll,draggable,Jquery,Scroll,Draggable,我有一个可以拖动的潜水器。当我把它拖近网页的一个边缘时,整个网站就会滚动。我可以禁用这个功能吗? (我基本上可以使用div在网页上移动,但我希望它仅限于我当前所在的位置) 我使用jquery可拖动脚本 标题: link href="stilmallaudioplayer.css" rel="stylesheet"> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script s
link href="stilmallaudioplayer.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<style>
</style>
<script>
$(function() {
$( "#audioplayer" ).draggable();
});
</script>
您可以在
主体
上设置溢出:隐藏
,或者在拖动开始
时设置容器元素,并在拖动停止
时将其删除:
Js:
CSS:
您可以在
主体
上设置溢出:隐藏
,或者在拖动开始
时设置容器元素,并在拖动停止
时将其删除:
Js:
CSS:
您可以在
主体
上设置溢出:隐藏
,或者在拖动开始
时设置容器元素,并在拖动停止
时将其删除:
Js:
CSS:
您可以在
主体
上设置溢出:隐藏
,或者在拖动开始
时设置容器元素,并在拖动停止
时将其删除:
Js:
CSS:
这似乎有效:
jQuery
$(function () {
$("#audioplayer").draggable(
{ containment: "html", scroll: false }
);
});
CSS
html, body {
height:100%;
overflow:hidden;
}
#audioplayer {
padding: 0.5em;
z-index: 3;
position: absolute;
top: 100px;
left: 100px;
border: 1px solid black;
height:20px;
width: 100px;
}
这似乎有效:
jQuery
$(function () {
$("#audioplayer").draggable(
{ containment: "html", scroll: false }
);
});
CSS
html, body {
height:100%;
overflow:hidden;
}
#audioplayer {
padding: 0.5em;
z-index: 3;
position: absolute;
top: 100px;
left: 100px;
border: 1px solid black;
height:20px;
width: 100px;
}
这似乎有效:
jQuery
$(function () {
$("#audioplayer").draggable(
{ containment: "html", scroll: false }
);
});
CSS
html, body {
height:100%;
overflow:hidden;
}
#audioplayer {
padding: 0.5em;
z-index: 3;
position: absolute;
top: 100px;
left: 100px;
border: 1px solid black;
height:20px;
width: 100px;
}
这似乎有效:
jQuery
$(function () {
$("#audioplayer").draggable(
{ containment: "html", scroll: false }
);
});
CSS
html, body {
height:100%;
overflow:hidden;
}
#audioplayer {
padding: 0.5em;
z-index: 3;
position: absolute;
top: 100px;
left: 100px;
border: 1px solid black;
height:20px;
width: 100px;
}