Skip to content

ctx.height()

ctx.height — Extensions > Layout context > Bounds. Cytoscape.js signatures, parameters and return contract.

ctx.height — Extensions › Layout context › Bounds

Preview · Extensions › Layout context › Bounds

Read in the complete API reference · All API members

// The viewport height in CSS px
ctx.height(): number

The viewport height in CSS px.

Returns number

the viewport height

Example

// Inside a custom layout, ctx is supplied by the library.
cy.layout({ impl: { run(ctx) {
console.log(ctx.height()); // 600
} } }).run();

Example graph and handle setup