问题
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