This commit is contained in:
ztplz 2019-01-03 11:10:06 +08:00 committed by 偏右
parent a019c0033f
commit 1bdb8e5939

View File

@ -164,7 +164,7 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
const targetInnerHeight =
(targetNode as Window).innerHeight || (targetNode as HTMLElement).clientHeight;
// ref: https://github.com/ant-design/ant-design/issues/13662
if (scrollTop > elemOffset.top - (offsetTop as number) - 1 && offsetMode.top) {
if (scrollTop >= elemOffset.top - (offsetTop as number) && offsetMode.top) {
// Fixed Top
const width = elemOffset.width;
const top = targetRect.top + (offsetTop as number);
@ -179,7 +179,8 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
height: elemSize.height,
});
} else if (
scrollTop < elemOffset.top + elemSize.height + (offsetBottom as number) - targetInnerHeight &&
scrollTop <=
elemOffset.top + elemSize.height + (offsetBottom as number) - targetInnerHeight &&
offsetMode.bottom
) {
// Fixed Bottom