I calculate item width in css , and do the same in js.
First one for element style, second one for carousel track calculation.
My CSS:
.category-carousel .carousel-item {
width: calc((100vw - 80px) / 7); // result is 262.544px
}
and my JS:
var itemWidth = (window.innerWidth - 80) / 7; // result is 262.857px
Result is 262.544 and 262.857.
(I use more then 200 elements , so 200 * 0.313 give me 62px of issue)
Why its work this way ?
DEMO
https://jsfiddle.net/2nwLq7vd/5/
Width and console result are not equal