2017-03-06 121 views
-2

https://github.com/a115/HTML-SVG-connect我使用這個插件繪製可拖動的線。但是這個插件不給我加載svg後重新創建線的權限。我想在兩個元素上單擊時創建行。如何重新加載整個svg點擊一個按鈕後沒有重新加載頁面

+0

請一些代碼添加到您的問題,您已到目前爲止已經試過。 –

+0

您能否提供[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。 –

+0

https://gist.github.com/alojzije/11127839 – mnjroy

回答

-1
addSvgInHere = function(_this, $element, $svg, defs, markerObjCircleS, circleObjS, markerObj, arrowObj) { 
    timerId = setInterval(function(argument) { 
    $element.append($svg); 
       if ($(_this).attr('data-trigger') != "true") { 
       $(defs).appendTo($svg);       
       }  

       },500); 
    setInterval(function (argument) { 
       markerObjCircleS.appendChild(circleObjS); 
       markerObj.appendChild(arrowObj); 
       $(defs).append(markerObjCircleS); 
       $(defs).append(markerObj);   
    },1000); 
}; 
+0

我這樣解決這個問題。 – mnjroy

0
/*css*/ 
svg { 
    width: 100% !important; 
    height: 100% !important; 
    width: 100% !important; 
    height: 100% !important; 
    position: absolute !important; 
    top: 0 !important; 
    left: 0 !important; 
} 
+0

解決!我用這個CSS凍結SVG和線。 – mnjroy

+0

對不起!但這不是什麼不同的答案,我只是在一段時間之後「將」svg添加到div中,所以它會自動逐個追加。所以我通過CSS修正了{position:absolute;}。 – mnjroy

+0

對此問題有兩個單獨的答案。這是爲什麼? –

相關問題