Removing fixed classes does not properly remove them from the presetation

a 夏天 提交于 2019-12-08 03:29:52

问题


Concerning: Remove all .fixed classes from force layout nodes with jQuery

I can remove the fixed classes now. But the nodes are still fixed in the view.

So simply removing the class is not enough I believe. I didn't find any help in the docs of D3 as well.


回答1:


Are you wanting to go back to the force layout ?

Its because you have only removed the class not the actual fixed property.

Try this :

 d3.selectAll(".node") //select your node here
    .each(function(d){d.fixed = false;})
    .classed("fixed", false);
 force.start(); //-bring the force layout back

Updated fiddle : http://jsfiddle.net/d2gjxy7n/11/



来源:https://stackoverflow.com/questions/28679156/removing-fixed-classes-does-not-properly-remove-them-from-the-presetation

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