簡體   English   中英

使用jQuery UI“ Accordion and Droppable”第2部分

[英]Working with jQuery UI “Accordion and Droppable” Part 2

使用同一問題: 使用jQuery UI“ Accordion and Droppable”

如果要選擇一個項目,則將其放入手風琴( <h3> ),然后將其附加到<ul>

例如,將“項目1”拖到“ B”,然后將“項目1”附加到黃色列表中。

如何修改程序?

$(function() {
    $( "#sortable1, #sortable2" ).sortable({connectWith: '.connectedSortable'}).disableSelection();

    var $tabs = $( "#tabs" ).accordion({
        heightStyle: "content",
        collapsible: true,
        header: "> div > h3",
        beforeActivate: function( event, ui ) {
            $("#maps").width( $("#tabsMap").innerWidth() - $("#mapList").width() - 34 );
        },
        activate: function( event, ui ) {
            $("#maps").width( $("#tabsMap").innerWidth() - $("#mapList").width() - 32 );
        }
    }).sortable({
        axis: "y",
        handle: "h3",
        stop: function( event, ui ) {
            ui.item.children( "h3" ).triggerHandler( "focusout" );
        }
    });
});

http://jsfiddle.net/ZjvWN/2/

您需要將<h3>為可放置的目標,然后在“ drop”事件上將目標項目附加到相應的<ul>

請參閱: http//api.jqueryui.com/droppable/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM