Is absolute positioning valuable for scroll to the element when one appears

那年仲夏 提交于 2019-12-12 04:44:41

问题


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?

来源:https://stackoverflow.com/questions/46357553/is-absolute-positioning-valuable-for-scroll-to-the-element-when-one-appears

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!