Skip to content Skip to sidebar Skip to footer

Div Positioning Is Calculated Fine But Need Explanation How It Is Working

Can someone explain how this is working. I am creating sidepanel ad and to place the panels i want the position of the width. When i upload the script on my server then i get a sm

Solution 1:

I'm willing to bet that it's because the element you're searching for (by the way, getElementsByClassName is a thing) is relatively positioned to the element containing it and thus has position 0,2 or what-ev.

That getPosition function crawls up the parent tree, so the parent node spits out the right position because it's relative to the document.

Finally, the document itself is relative to itself and thus has zero offset.

Post a Comment for "Div Positioning Is Calculated Fine But Need Explanation How It Is Working"