I think I am running into a Template Literal issue. I am trying to get some values, add them together to make a new value and then apply it to the target element. But when I add them together, no value is returned.
const el = document.querySelector('.row[data-target="row-offset"]');
const distanceFromLeft = el.offsetLeft;
const paddingLeft = window.getComputedStyle(el, null).getPropertyValue('padding-left');
const target = document.querySelector('#hero-carousel .flickity-page-dots');
target.style.left = `${distanceFromLeft + paddingLeft}px`;
I have alerted out the querySelector elements and thus know I am targeting them correctly. Console logging both distanceFromLeft and paddingLeft results in values being outputted.
Therefore I am left thinking there is something wrong with my Template Literal. No errors are being reported.
I have mocked up the issues here
The expected result is for target to have the same value as el.