With an element that uses calc()
for positioning (e.g. div { left: calc(100% - 50px); }
) Safari returns nil for window.getComputedStyle(elem).left
Is there a workaround for this?
With an element that uses calc()
for positioning (e.g. div { left: calc(100% - 50px); }
) Safari returns nil for window.getComputedStyle(elem).left
Is there a workaround for this?
Try using Element.getBoundingClientRect()
var elem = document.querySelector(/* selector */);
var elemPositionLeft = elem.getBoundingClientRect().left;