0
上から1つのdivを配置することはできますが、使用するときはbottom :20%
が機能しません。私はそのdivにposition:fixed
を与えようとしましたが、bottom: 20%
を使用しました。ドラッグするとdivの時間が長くなります。下端との相対位置が正しくない
$(function() {
$("#draggable1,#draggable2").draggable({ containment: "#containment-wrapper", scroll: false });
});
#containment-wrapper {
width: 95%;
height: 400px;
border: 2px solid #ccc;
padding: 10px;
}
h3 {
clear: left;
}
.draggable {
width: 90px;
height: 90px;
padding: 0.5em;
float: left;
margin: 0 10px 10px 0;
}
#draggable1 {
position: relative;
border: 2px solid black;
top: 20%;
}
#draggable2 {
position: relative;
border: 2px solid black;
bottom: 20%;
}
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div id="containment-wrapper">
<div id="draggable1" class="draggable ui-widget-content">
<p>I'm from top 20%</p>
</div>
<div class="draggable ui-widget-content">
<p id="draggable2" class="ui-widget-header">I'm from bottom 20%</p>
</div>
</div>
ようだ、私は本当に期待される結果 –
があなたに別のを見てみましょうされているものが理解していないの適用要素とt特定のクラスとIDが間違った要素(つまり、親要素の代わりに入れ子になった要素)に割り当てられているという印象を受けます。 – UncaughtTypeError