Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get position for fixed element without jquery?

Hello there

I have an element with fixed position, I can't detect position and must be use javascript clearly, without frameworks (jquery, mootools, etc).

like image 740
mrsum Avatar asked Jan 11 '13 06:01

mrsum


1 Answers

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
like image 133
Totty.js Avatar answered Oct 26 '22 23:10

Totty.js