Element.asPX(attr, [value])

px值(非%, em等)返回元素给定的属性。


参数
  • attr 字符串。属性名称。
  • value 字符串。属性值。

返回值

元素。返回选择查询的结果。


使用
<svg id="svg" width="100" height="100"></svg>
var svg = Snap("#svg");
var c = svg.paper.circle(50, 50, 40);

console.log(c.asPX("cx"));    // 50