Skip to content

ele.width()

eles.width — Collection > Position and dimensions. Cytoscape.js signatures, parameters and return contract.

eles.width — Collection › Position and dimensions

Preview · Collection › Position and dimensions

Read in the complete API reference · All API members

// Read the first element's width in model pixels: a node's content width, excluding padding and border, or an edge's stroke width
ele.width(): number | undefined

Read the first element's width in model pixels: a node's content width, excluding padding and border, or an edge's stroke width. A compound parent's width is derived from its children. The read reflects the current value during size animations.

Returns number | undefined

the width, or undefined when empty or removed

Example

console.log(eles.width()); // 30

Example graph and handle setup

See

Collection#outerWidth to include the border