JSplump可拖动元素javascript函数

JSplump可拖动元素javascript函数,javascript,jquery,css,jsplumb,Javascript,Jquery,Css,Jsplumb,这将使您清楚地了解问题所在 我希望端点绑定到每个容器中的元素,这些元素是可拖动的,但只有首先绘制的端点是正确的。第二次调用draw函数时,位置不正确,拖动不同步 我猜问题在于CSS的位置,但我找不到它 jsPlumb.ready(function() { $(".scroll-box").draggable({ drag: function() { jsPlumb.repaintEverything(); //jsPlumb.repaint($(this));

这将使您清楚地了解问题所在

我希望端点绑定到每个容器中的元素,这些元素是可拖动的,但只有首先绘制的端点是正确的。第二次调用draw函数时,位置不正确,拖动不同步

我猜问题在于CSS的位置,但我找不到它

jsPlumb.ready(function() {
  $(".scroll-box").draggable({
    drag: function() {
      jsPlumb.repaintEverything();
      //jsPlumb.repaint($(this)); 

    }
  });
  //            jsPlumb.draggable($(".scroll-box"));


  drawEndPoints("in-leaf", "Right");
  drawEndPoints("out-leaf", "Left");



});

function drawEndPoints(classname, endpointposition) {

  var endpointOptions = {
    isSource: true,
    isTarget: true,
    endpoint: ["Dot", {
      radius: 10
    }],
    style: {
      fillStyle: 'blue'

    },
    maxConnections: -1,
    connector: "Straight",
    connectorStyle: {
      lineWidth: 2,
      strokeStyle: 'black'
    },
    scope: "blackline",
    dropOptions: {
      drop: function(e, ui) {
        alert('drop!');
      }
    }
  };

  jsPlumb.addEndpoint($("." + classname), {
    anchor: endpointposition
  }, endpointOptions);
  //jsPlumb.repaintEverything();
}

您缺少
jsPlumb.setContainer($(“body”)


编辑:对你的例子进行修改

挽救了这一天!我是新来的。我是否还遗漏了其他重要方面@我帮助过mkaranGlad:)。嗯,我现在想不起任何需要注意的事情了,请看一下,另外,最好设置一个on window resize-->jsPlumb.repaint()事件,以便jsPlumb能够很好地响应窗口更改。至少但不是最后一个,如果您有许多连接器,请利用
jsPlumb.setSuspendDrawing(true)。祝你好运!:)