Is absolute positioning valuable for scroll to the

2019-08-17 06:15发布

问题:

I'm using sweetalert modal dialog. It is positioned to center of screen as I understand. But when I use it inside `iframe element (by URL) it appears in the center of built-in document, and as result not seen in view area.

I've tried to use position: absolute style on modal, it has not obvious influence:

  1. it is positioned as before, on the center of built-in document (why :\ ?)
  2. it is 'ensured' to seen on the view area as following: if modal rect not intersected with view area rect at all, browser scrolls to the modal immediately. But if modal rect at some point intersects view area rect (for instance, just bottom side of modal dialog seen) browser's scroll stays at the previous position.

What is the reason of the jump to the dialog ? Is it absolute positioning or something else?