On Drop - Clone a Different node or corresponding Element from the server

懵懂的女人 提交于 2020-01-01 18:18:48

问题


On the drop (after drag) -- how can I clone a different (corresponding) element that resides somewhere else or back on the server, i.e. target and clone a different element on the server

For e.g. On client side the corresponding icons map to the server elements icon_chartXY == Server side ChartXY etc..

1) in the browser on the left , I have small icons/pictures that represent various charts (xy, or barchart).

2) After dragging the icons, then drop into a larger

During clone - How can I GET or clone the actual chart (HTML, JS) from the server side, Which could be a actual chart represented by the icon, or an HTML/Js chart?

$(function () {

    $('.menu').draggable({
        helper: 'clone'
    });

    $('#droppable1, #droppable2').droppable({
        drop: function (event, ui) {
            $(this) 
                .append(ui.helper.clone(false).css({  // clone a different element
                position: 'relative',
                left: '0px',
                top: '0px'
            }));
        }
    });

});

JS Fiddle of how far I got

来源:https://stackoverflow.com/questions/22086508/on-drop-clone-a-different-node-or-corresponding-element-from-the-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!