Based on the coordinates set the absolute position of the control (overlay) to display it accordingly. The overlay can be started any side/corner of the element.
Get the element object using JQuery:
var obj = $('[id$=controlelement]');
Get the position of the element from Leftfunction findPosLeft(obj) 
{
    var pos = obj.offset();
    var left = pos.left;
    return left;
}
Get the position of the element from Topfunction findPosTop(obj) 
{
    var pos = obj.offset();
    var top = pos.top;
    return top;
}
Get the position of the element from Bottomfunction findPosBottom(obj) 
{
    var pos = obj.offset();
    var top = pos.top;
    var height = obj.height();
    var bottom = top + height;
    return bottom;
}
Get the position of the element from Rightfunction findPosRight(obj) 
{
    var pos = obj.offset();
    var left = pos.left;
    var width = obj.width();
    var right = left + width;
    return right;
}
 
 
No comments:
Post a Comment