Tom*_*Tom 8 javascript jquery jquery-ui
当图像比容器大时,使图像可拖动会做一些非常古怪的事情......有没有人知道解决这个问题的方法?
这是我的代码......
<script type='text/javascript' src="scripts/jquery-1.4.2.js"></script>
<script type="text/javascript" src="scripts/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("img").draggable({ containment: "div", scroll: false });
});
</script>
<style type="text/css">
div {
width:500px;
height:423px;
position:relative;
overflow:hidden;
}
</style>
Run Code Online (Sandbox Code Playgroud)
和...
<div>
<img src="images/map.jpg" width="1000" height="845" alt="Map" />
</div>
Run Code Online (Sandbox Code Playgroud)
如果您手动设置边界,它会起作用:
$("img").draggable({ containment: [0, 0, 500, 423], scroll: false });
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5747 次 |
最近记录: |