Element.remove(handler)
从DOM中移除该元素。
参数
元素。被分离的元素。
返回值
使用
<svg id="svg" width="300" height="100"></svg>
<input id="button" type="button" value="移除红色圈圈">
var svg = Snap("#svg");
var c1 = svg.paper.circle(50, 50, 40).attr({
fill: "#f00" // 红色
});
var c2 = svg.paper.circle(150, 50, 40).attr({
fill: "#00f" // 蓝色
});
document.getElementById("button").onclick = function() {
// 移除红色
c1.remove();
};