+ 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

1st Dec 2017, 9:55 AM
Saeed Noruzi
Saeed Noruzi - avatar
6 Answers
+ 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
1st Dec 2017, 10:45 AM
CalviŐ˛
CalviŐ˛ - avatar
0
The better way is use HTML and CSS. You don't need JavaScript.
1st Dec 2017, 10:03 AM
CalviŐ˛
CalviŐ˛ - avatar
0
i want do it dynamically
1st Dec 2017, 10:04 AM
Saeed Noruzi
Saeed Noruzi - avatar
0
Define dynamically in this case. you mentioned "fixed on.."
1st Dec 2017, 10:05 AM
CalviŐ˛
CalviŐ˛ - avatar
1st Dec 2017, 10:12 AM
Saeed Noruzi
Saeed Noruzi - avatar
0
i wrote this but it doesn't work
1st Dec 2017, 10:12 AM
Saeed Noruzi
Saeed Noruzi - avatar