【发布时间】:2011-04-21 12:24:58
【问题描述】:
在JQueryUI draggable demo 中,我可以看到您可以将句柄附加到 DIV,但如果句柄未嵌套在可拖动的父 DIV 中,则它不起作用,例如
<script src="jquery-1.5.2.js"></script>
<script src="js/jquery-ui-1.8.11.custom.min.js"></script>
<style>
#hBlack
{
width:55px;
height:55px;
background-color: black;
top:0px;
}
#hGreen
{
width:25px;
height:25px;
background-color: green;
}
</style>
<script language="javascript" type="text/javascript">
$(function() {
$("#hBlack").draggable({handle:"#hGreen"});
});
</script>
</head>
<body>
<div id="hBlack">
</div>
<div id="hGreen"></div>
以上内容不会使 #hGreen 成为句柄 - 但以下内容会:
<div id="hBlack">
<div id="hGreen"></div>
</div>
基本上,我正在尝试在另一个移动时进行一个 DIV 移动 - 我想你可以使用 new Position utility 来完成它,但对于像我这样的新手,我发现它的文档记录很差
【问题讨论】: