Avoid affix element is higher than view port

This commit is contained in:
afc163 2017-12-10 16:50:39 +08:00
parent e13c6d87fa
commit 31a0654ef9
2 changed files with 4 additions and 1 deletions

View File

@ -157,10 +157,12 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
if (scrollTop > elemOffset.top - (offsetTop as number) && offsetMode.top) {
// Fixed Top
const width = elemOffset.width;
const top = targetRect.top + (offsetTop as number);
this.setAffixStyle(e, {
position: 'fixed',
top: targetRect.top + (offsetTop as number),
top,
left: targetRect.left + elemOffset.left,
maxHeight: `calc(100vh - ${top}px)`,
width,
});
this.setPlaceholderStyle({

View File

@ -3,4 +3,5 @@
.@{ant-prefix}-affix {
position: fixed;
z-index: @zindex-affix;
overflow: auto;
}