I am thinking about using JavaScript to make a div in the parent webpage to follow the position of another element inside an iframe; the position of the element in the iframe changes when the size of the window changes (responsive design), so is it possible to make the div at the parent page change position accordingly as well? I simply don't know where to start
Asked
Active
Viewed 43 times
1 Answers
0
You can get the element inside the iframe:
document.getElementById('iFrame').contentWindow.document.getElementById('x');
Once you get the element you can work with his position, to get element position with pure javascript look this.
It's simpler to do this with jquery, but maybe with javascript it's more efficient.
After all, just position your div according to the position of the element.

Mathiasfc
- 1,627
- 1
- 16
- 24
-
Thanks! I will try it out and report back! @@ – Kelvin C Jun 06 '17 at 00:44