Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Avoid affix element is higher than view port
- Loading branch information
Showing
with
4 additions
and
1 deletion.
-
+3
−1
components/affix/index.tsx
-
+1
−0
components/affix/style/index.less
|
@@ -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({ |
|
|
|
@@ -3,4 +3,5 @@ |
|
|
.@{ant-prefix}-affix { |
|
|
position: fixed; |
|
|
z-index: @zindex-affix; |
|
|
overflow: auto; |
|
|
} |
This comment has been minimized.
This comment has been minimized.
The
overflow:auto
breaks any box-shadow on your containing divs, e.g.:<Affix> <Header style={{ boxShadow: '0 2px 10px rgba(0,0,0,.2)' }}>Hello</Header> </Affix>
Any suggestions?