docs: translate affix to english (#1471) (#2219)

pull/2244/head
偏右 9 years ago committed by Benjy Cui
parent b2ff1dcc75
commit 1cf55c2b16

@ -1,16 +1,24 @@
---
order: 0
title: 基本
title:
zh-CN: 基本
en-US: Basic
---
## zh-CN
最简单的用法。
## en-US
The simplest usage.
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(
<Affix>
<Button type="primary">固定在顶部</Button>
<Button type="primary">Affix top</Button>
</Affix>
, mountNode);
````

@ -1,16 +1,24 @@
---
order: 2
title: 下方固定
title:
zh-CN: 下方固定
en-US: Bottom
---
固定在屏幕下方
## zh-CN
固定在屏幕下方。
## en-US
Affix to bottom.
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(
<Affix offsetBottom={20}>
<Button type="primary">固定在距离底部 20px 的位置</Button>
<Button type="primary">20px to affix bottom</Button>
</Affix>
, mountNode);
````

@ -1,16 +1,24 @@
---
order: 1
title: 偏移
title:
zh-CN: 偏移
en-US: Offset
---
## zh-CN
达到一定的偏移量才触发。
## en-US
Affix element according to offset value.
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(
<Affix offsetTop={75}>
<Button type="primary">固定在距离顶部 75px 的位置</Button>
<Button type="primary">75px to affix top</Button>
</Affix>
, mountNode);
````

@ -1,16 +1,24 @@
---
order: 3
title: 固定状态改变的回调
title:
zh-CN: 固定状态改变的回调
en-US: Callback
---
## zh-CN
可以获得是否固定的状态。
## en-US
Callback with affixed state.
````jsx
import { Affix, Button } from 'antd';
ReactDOM.render(
<Affix offsetTop={120} onChange={affixed => console.log(affixed)}>
<Button>固定在距离顶部 120px 的位置</Button>
<Button>120px to affix top</Button>
</Affix>
, mountNode);
````

@ -0,0 +1,21 @@
---
category: Components
type: Other
english: Affix
---
Make an element sticky to viewport.
## When to use
When user browses a long web page, some content need to sticky to viewport. It is common for menus and actions.
Please note that Affix should not cover other content in page, especially when the size of viewport is small.
## API
| Property | Description | Type | Default |
|--------------|-----------------------|----------|--------------|
| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 |
| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - |
| onChange | Callback when affix state is changed | Function(affixed) | - |

@ -20,4 +20,4 @@ english: Affix
|-------------|----------------|--------------------|--------------|
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | |
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | |
| onChange | 固定状态改变时触发的回调函数 | Function | 无 |
| onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 |
Loading…
Cancel
Save