JQuery 中的 UI 拖放

发布于 2024-12-09 01:47:18 字数 140 浏览 0 评论 0原文

我正在开发拖放界面。一切正常。我需要一些附加功能的帮助。

我有 3 列包含拖动的项目。每个项目都有一个标题编号:1,2,3,...我想更改面板标题中的数字以反映面板在列中的顺序(因此,如果将面板拖动到顶部,它会变为 1 并且下面的面板 2、3 等)。

I'm working on Drag'n'Drop interface. Everything works OK. I need help with some additional functionality.

I have 3 columns with dragged items. Every item have a title number: 1,2,3,... I want to change the number in the panel title to reflect the order of the panel in the column (so if you drag a panel to the top it becomes 1 and the panels below it 2, 3 etc.).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

错爱 2024-12-16 01:47:18

这是你想要的吗?

$( ".content .draggable-area" ).sortable({
    connectWith: ".draggable-area",
    tolerance: "pointer",
    cursor: "move",
    cursorAt: {top: 10, left: 10},
    distance: 30,
    opacity: 0.8,
    stop: function(event, ui) {
        $('.draggable-area').each(function(){
            $(this).find('.draggable-box').each(function(){
               $(this).find('h2').html($(this).index()+1); 
            });
        });
    }
});

演示:
http://jsfiddle.net/Xr3ne/1/

Is this what you want?

$( ".content .draggable-area" ).sortable({
    connectWith: ".draggable-area",
    tolerance: "pointer",
    cursor: "move",
    cursorAt: {top: 10, left: 10},
    distance: 30,
    opacity: 0.8,
    stop: function(event, ui) {
        $('.draggable-area').each(function(){
            $(this).find('.draggable-box').each(function(){
               $(this).find('h2').html($(this).index()+1); 
            });
        });
    }
});

demo:
http://jsfiddle.net/Xr3ne/1/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文