JQuery UI 可排序占位符样式问题

标签 jquery user-interface jquery-ui-sortable placeholder

我一直在试图为 friend 解决这个问题。他们有一个 HTML5 本地音乐播放器,允许用户拖放播放列表中的项目。然而,占位符的颜色没有显示,其他元素如高度和行高。这是 JSFiddle,因此您可以看到我在说什么:http://jsfiddle.net/aYYUU/预先感谢您的帮助。

最佳答案

尝试以下操作。这是因为占位符是一个空行。只需在其中附加 td 即可。

JSFiddle

HTML

<table id="songList">
<thead>
    <tr>
        <th id="check"><input type="checkbox" title="Select All"></th>
        <th id="delete"><button title="Delete Selected"></button></th>
        <th id="play"><button></button></th>
        <th id="artist" style="width: 296px; ">Artist</th>
        <th id="title" style="width: 296px; ">Title</th>
        <th id="album" style="width: 297px; ">Album</th>
    </tr>
</thead>
<tbody style="height: 204px; " class="ui-sortable"><tr class="ui-state-default playing"><td class="check"><input type="checkbox"></td><td class="delete"><button title="Delete From List"></button></td><td class="play"><button></button></td><td class="artist" style="width: 296px; ">Masakazu Sugimori</td><td class="title" style="width: 296px; ">Ace Attorney ~ Prologue</td><td class="album" style="width: 280px; ">Phoenix Wright - Ace Attorney OST</td></tr><tr class="ui-state-default"><td class="check"><input type="checkbox"></td><td class="delete"><button title="Delete From List"></button></td><td class="play"><button></button></td><td class="artist" style="width: 296px; ">Masakazu Sugimori</td><td class="title" style="width: 296px; ">Reminiscence ~ Case DL-6</td><td class="album" style="width: 280px; ">Phoenix Wright - Ace Attorney OST</td></tr><tr class="ui-state-default"><td class="check"><input type="checkbox"></td><td class="delete"><button title="Delete From List"></button></td><td class="play"><button></button></td><td class="artist" style="width: 296px; ">Masakazu Sugimori</td><td class="title" style="width: 296px; ">Rise From The Ashes ~ End</td><td class="album" style="width: 280px; ">Phoenix Wright - Ace Attorney OST</td></tr></tbody>
</table>

CSS

table input[type=checkbox], table button {
    border: none;
    margin: 0;
    padding: 0;
    width: 13px;
    height: 13px;
    position: relative;
    top: 1px;
}

table {
    border-spacing: 0;
    width: 100%;
}

JS

$('#songList tbody').sortable({
    refreshPositions: true,
    opacity: 0.6,
    scroll: true,
    containment: 'parent',
    placeholder: 'ui-placeholder',
    tolerance: 'pointer',
    'start': function (event, ui) {
        ui.placeholder.html("<td colspan='6'></td>")
    }
}).disableSelection();

关于JQuery UI 可排序占位符样式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8707260/

相关文章:

jQuery 可排序连接多个列表

javascript - 从具有相同类的不同 HTML 元素中获取值

windows - 如何知道菜单项何时被点击?

c++ - 当鼠标悬停在边框上时,如何完全禁用调整窗口大小,包括调整大小图标?

Java GUI : Image will be overwritten, 路径相同 -> 在框架中显示它(图像仍然相同)

javascript - jQuery UI 可排序和可拖动问题

jquery - 配对多个 jQueryUI 可排序而不交叉

javascript - 如何在 jQuery 单击事件期间检索列表项的子位置?

php - 如何使用 html ID 和 jQuery 显示/隐藏动态元素

javascript - 按钮单击以替换图像