You can try the following code where this function is used for getting the height of window:
function GetHeight()
{
var y = 0;
if (self.innerHeight)
{
y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
y = document.documentElement.clientHeight;
}
else if (document.body)
{
y = document.body.clientHeight;
}
return y;
}
And then use jQuery to give height
to your div dynamically like this:
document.ready(function(){
var heightOfDiv = GetHeight();
jQuery('#rightRail').css("top",heightOfDiv +"px");
});
After you can manipulate the variable heightOfDiv
by adding or subtracting pixels according to your need.
Maybe this works for you.