There seems to be an issue with jQuery not functioning well with CSS "transform: scale()" (however, it works fine with "transform: translate()")
Please examine this straightforward example:
$(document).ready(function() {
$('#root').dblclick(function() {
$('#box').position({
my: 'right bottom',
at: 'right bottom',
of: $('#root')
});
})
$('#box').draggable({
containment: $('#root'),
});
});
body {
position: relative;
margin: 0;
}
#root {
position: absolute;
top: 20px;
left: 20px;
width: 500px;
height: 500px;
border: solid 2px red;
transform-origin: 0 0 0;
transform: scale(0.5);
}
#box {
position: absolute;
top: 100px;
left: 50px;
display: inline-block;
width: 50px;
height: 50px;
background: red;
border: solid 1px black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
drag red box :)
<br/>double click in square to position box
<div id="root">
<div id="box"></div>
</div>
The root node needs to be scaled because I utilize fullscreen mode in my actual application and must adjust content to the window resolution. However, when scaling the parent element, jQuery UI draggable and jQuery position do not function correctly.
The crucial question is how to rectify this issue and make it work seamlessly?
Although there are numerous similar inquiries, a suitable solution remains elusive.