I have created a JSFiddle demo to illustrate this.
The key is to apply position:relative;
to the parent element and position:absolute;
to the child element that you want to position.
(Then adjust the position of the child element as needed)
UPDATE
Check out the updated version of the JSFiddle here which incorporates jQuery UI .position() functionality.
HTML
<div class="anchor">
<div class="content">
</div>
<button class="fixed-button">Fixed position button</button>
</div>
JavaScript
$(function(){
$(".fixed-button").each(function(arg, el){
$(el).position({
of: $(el).closest(".anchor")[0],
my: "left top",
at: "left+500 top+10"
});
});
});
UPDATE 2
I've now realized that achieving this effect can be done using CSS only by utilizing the "anchor" container around the content and button elements. Take a look at the new and (hopefully) final JSFiddle demo
CSS
.anchor{
position: relative;
}
.fixed-button{
position: absolute;
top: 10px;
right: 50px;
}