I'm trying to make one div appear on other div in such a way that they overlap each other. I'm using .position() method of jquery.
I've seen this method in this question CSS position element "fixed" inside scrolling container
$(function() {
$(".blue").position({
my: "right top",
at: "left center",
of: ".red"
});
});
.red,
.blue {
float: left;
width: 200px;
height: 200px;
}
.red {
background: red;
}
.blue {
background: blue;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="blue">
</div>
<div class="red">
</div>