Jquery可排序元素在拖放时分配

问题描述 投票:0回答:1

[我正在尝试在我的网站中实现jquery的sortable,但是它行为异常。当我尝试将元素拖到另一个位置时,似乎分配了其他元素,所以我想知道是否有人可以向我解释为什么会这样?] >

$( function() {
    $( "#sortable" ).sortable();
    $( "#sortable" ).disableSelection();
  } );
<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="sortable"> 
  <img src="https://html.com/wp-content/plugins/htmlcodetutorial-plugin/assets/images/firefox-true.png" height="100px" width="100px" class="ui-state-default">
  <img src="https://html.com/wp-content/plugins/htmlcodetutorial-plugin/assets/images/firefox-true.png" height="100px" width="100px" class="ui-state-default">
  <img src="https://html.com/wp-content/plugins/htmlcodetutorial-plugin/assets/images/firefox-true.png" height="100px" width="100px" class="ui-state-default">
  <img src="https://html.com/wp-content/plugins/htmlcodetutorial-plugin/assets/images/firefox-true.png" height="100px" width="100px" class="ui-state-default">

</div>

我正在尝试在我的网站中实现jquery的sortable,但是它的行为异常。当我尝试将元素拖到另一个位置时,似乎分配了其他元素,所以我想知道是否有人可以...

jquery html jquery-ui-sortable
1个回答
0
投票

从图像中删除宽度和高度,然后另外使用此CSS:

© www.soinside.com 2019 - 2024. All rights reserved.