How to get position for fixed element without jquery?

Use:

var boundingBox = node.getBoundingClientRect();

Check out the result, you have an object like this:

top    : 0,
right  : 0,
bottom : 0,
left   : 0,
width  : 0,
height : 0

function findPos(obj) {

    var curleft = curtop = 0;

    if (obj.offsetParent)
    do {
        curleft += obj.offsetLeft;
        curtop += obj.offsetTop;

    } while (obj = obj.offsetParent);

    return [curleft,curtop];
}

http://www.quirksmode.org/js/findpos.html


Does this help:

document.getElementById('id').offsetLeft // + window.scrollX
document.getElementById('id').offsetTop // + window.scrollY

You might want to look at : This Question