JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://jquery-ui.googlecode.com/svn/trunk/ui/jquery.ui.core.js"></script>
<script src="http://jquery-ui.googlecode.com/svn/trunk/ui/jquery.ui.position.js"></script>
<div class="main">
<div class="one"></div>
</div>
CSS
.main {
width: 90%;
height:200px;
background:#000;
}
.one {
width: 20px;
height:20px;
background:#f00;
}
JavaScript
function moveit() {
$(".one").position({
"my": "right top",
"at": "right top",
"of": $(".main"),
"collision": "fit fit"
});
}
$(window).resize(function(){
moveit();
});
moveit();