I'm tried to put layer 1 override layer 2(when i drag layer 2) but Offset() incorrect. I use jQuery UI from Google
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
you are assigning the top and left properties wrongly while setting the offset to the div.
top
property should be assigned the value of variable y
and left
property with the variable x
.
Change the code to below:
$('.show-div').offset({top: y, left: x });