Jayming1024
Jayming1024
  • 发布:2015-08-14 03:38
  • 更新:2015-08-14 03:38
  • 阅读:9237

popover弹窗在有滚动条的情况下显示位置小问题

分类:MUI

popover的位置在有滚动条拖动后的情况下会弹出在可视窗口以下
可以修改mui.js解决:

if ((pHeight + arrowSize) < (offset.top - window.pageYOffset-window.scrollY+30)) { //top  
    pTop = offset.top - pHeight - arrowSize-window.scrollY;  
} else if ((pHeight + arrowSize) < (wHeight - (offset.top - window.pageYOffset-window.scrollY) - aHeight)) { //bottom  
    position = 'bottom';  
    pTop = offset.top + aHeight + arrowSize-window.scrollY+18;  
} else { //middle  
    position = 'middle';  
    pTop = Math.max((wHeight - pHeight) / 2 + window.pageYOffset-window.scrollY, 0);  
    pLeft = Math.max((wWidth - pWidth) / 2 + window.pageXOffset, 0);  
}

window.scrollY是滚动条的高度
window.scrollY+30是考虑到一般app都有header和nav,+30避免被他们挡住弹窗

0 关注 分享

要回复文章请先登录注册