Bug 1558312 - Optimistic loading for DS images (#5111)
This commit is contained in:
Родитель
b075386a8b
Коммит
594670ce05
|
@ -42,7 +42,13 @@ export class DSImage extends React.PureComponent {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.observer = new IntersectionObserver(this.onSeen.bind(this));
|
||||
this.observer = new IntersectionObserver(this.onSeen.bind(this), {
|
||||
// Assume an image will be eventually seen if it is within 520px of the viewport
|
||||
// This is half the average Desktop vertical screen size:
|
||||
// http://gs.statcounter.com/screen-resolution-stats/desktop/north-america
|
||||
rootMargin: `540px`,
|
||||
});
|
||||
|
||||
this.observer.observe(ReactDOM.findDOMNode(this));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче