There is a button on the site that should always be visible. It shifts when scrolling (the js script replaces the new class when scrolling).
The problem is that I can’t adapt it in any way adaptive to the PARENT after this offset. I set the styles for the class being added when scrolling:
.scrolled { position: fixed; top: 0; left: 50%; } and get offset from the left edge of the element. And you need to shift the element relative to its center.
The element is a button with a width of 186 px. Accordingly, it is necessary to position it somehow to the left by (50% of the width of the browser window - 93 px;). I do not see any other solutions yet.
Can this be done using css?
Tried a transform, but this property does not work for position: fixed;
In general, "we ourselves are not local, help than you can" :( Thank you!