+ 1
how to get and set position of elements with java script dynamically?
i have 3 elements. one fixed on top of the called header ,another fixed on bottom of page footer,i want my third elements top equal to bottom of header element and the bottom of it equal to top of ther footer element
6 Antworten
+ 1
You need to define the element width and height first and position to fixed in CSS. And you cant use style function to get the bottom position.
You need getBoundingClientRect() function.
Here you go...
https://code.sololearn.com/W7g2opzmGB8K/?ref=app
0
The better way is use HTML and CSS. You don't need JavaScript.
0
i want do it dynamically
0
Define dynamically in this case. you mentioned "fixed on.."
0
i wrote this but it doesn't work