You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why clientWidth and clientHeight of the element is 0 on the view onRender method? If I read them with a setTimeout they are not 0 anymore and I get their valid values.
I have also set the width and height through model attributes and also in the style.
If I can't get these values in onRender where should I get them?
I'm trying to set the width and height of a canvas element.
...
model: {attributes: {width: '300px',height: '300px',}}view: {onRender({ el }){console.log(el.clientWidth,el.clientHeight);}}...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Why
clientWidth
andclientHeight
of the element is 0 on the viewonRender
method? If I read them with asetTimeout
they are not 0 anymore and I get their valid values.I have also set the width and height through model
attributes
and also in thestyle
.If I can't get these values in
onRender
where should I get them?I'm trying to set the width and height of a
canvas
element.Beta Was this translation helpful? Give feedback.
All reactions