moveable
moveable copied to clipboard
[question] - Is there any way to get/set a relative position?
Environments
- Framework name: vanilla
- Framework version:
- Moveable Component version: latest
- Testable Address(optional):
Description
First, I want to say thank you for the awesome library! I'm interested in the question, is there any way to get/set a relative position?
@antonreshetov What does relative position mean?
-
position: relative;
? -
left: 10px; top: 10px
?
As a percentage of the container.
left: 10%; top: 10%
@antonreshetov
It still only gives a value in px. I'm sorry.
left = `${e.left / e.target.offsetWidth * 100}%`;
top = `${e.top / e.target.offsetHeight * 100}%`;
@daybrush thanks, I think this is the way out. Math isn't my thing 😂
@antonreshetov okay. I'll add relative propery next release.