【问题标题】:Jsplumb dragging connection to top does not create scrollJsplumb拖动连接到顶部不会创建滚动
【发布时间】:2013-02-28 04:34:58
【问题描述】:

当我将 jsplumb 连接拖到浏览器顶部时,如何创建滚动? 我在网上搜索,但找不到创建卷轴的解决方案。

【问题讨论】:

    标签: jsplumb


    【解决方案1】:

    Click here to check the Demo

    JSPlumb 或 JQuery

    <script>
    
        var targetDropOptions = {
    
        };
    
        connectorHoverStyle = {
            lineWidth: 7,
            strokeStyle: "#2e2aF8",
            cursor: 'pointer'
        }
    
        //Setting up a Target endPoint
        var targetColor = "#316b31";
        var targetEndpoint = {
            anchor: "LeftMiddle",
            endpoint: ["Dot", { radius: 8}],
            paintStyle: { fillStyle: targetColor },
            //isSource: true, 
            scope: "green dot",
            connectorStyle: { strokeStyle: targetColor, lineWidth: 8 },
            connector: ["Flowchart", { curviness: 63}],
            maxConnections: 1,
            isTarget: true,
            dropOptions: targetDropOptions,
            connectorHoverStyle: connectorHoverStyle
        };
    
        //Setting up a Source endPoint
        var sourceColor = "#ff9696";
        var sourceEndpoint = {
            anchor: "RightMiddle",
            endpoint: ["Dot", { radius: 8}],
            paintStyle: { fillStyle: sourceColor },
            isSource: true,
            scope: "green dot",
            connectorStyle: { strokeStyle: sourceColor, lineWidth: 4 },
            connector: ["Flowchart", { curviness: 63}],
            maxConnections: 1,
            //            isTarget: true,
            dropOptions: targetDropOptions,
            connectorHoverStyle: connectorHoverStyle
        };
        jsPlumb.bind("ready", function () {
    
            jsPlumb.animate($("#A"), { "left": 50, "top": 100 }, { duration: "slow" });
            jsPlumb.animate($("#B"), { "left": 300, "top": 100 }, { duration: "slow" });
            var window = jsPlumb.getSelector('.window');
            jsPlumb.addEndpoint(window, targetEndpoint);
            jsPlumb.addEndpoint(window, sourceEndpoint);
    
            jsPlumb.draggable(window);
    
        });
    
    </script>
    

    HTML

    <div id="A" class="a window" 
        style="width: 100px; height: 100px; border: solid 1px;">
        <strong>A</strong>
    </div>
    <div id="B" class="b window" 
        style="width: 100px; height: 100px; border: solid 1px;">
        <strong>B</strong>
    </div>
    

    【讨论】:

    • 我检查了你的 jsfiddle,但它有问题,当你将对象拖到顶部时它被隐藏它不会创建滚动。
    • 我希望我的对象在我将对象移动到浏览器顶部时创建滚动,或者它应该停止并且不应该隐藏自身。
    • 无意冒犯,但问题并未真正得到解答。似乎是一个热门话题,因为 2 年以来堆栈溢出的帖子都没有提供明确的答案。
    • jsfiddle 不工作。上述代码中的哪个更改实际上解决了问题..?
    • github.com/jsplumb/jsplumb/issues/212.. 这对我有用。但是滚动不起作用。但是用户将无法拖动超出顶部和左侧的边界。
    【解决方案2】:

    在我的情况下,我有一个属性为 position:relative 和 overflow:scroll 的 div,并且该属性中的所有形状都可以上下滚动。希望能帮到你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多