25 lines
542 B
TypeScript
25 lines
542 B
TypeScript
import { IS_IOS } from './browser/windowEnvironment';
|
|
import forceReflow from './forceReflow';
|
|
|
|
const resetScroll = (container: HTMLDivElement, scrollTop?: number) => {
|
|
if (IS_IOS) {
|
|
container.style.overflow = 'hidden';
|
|
}
|
|
|
|
if (scrollTop !== undefined) {
|
|
container.scrollTop = scrollTop;
|
|
}
|
|
|
|
if (IS_IOS) {
|
|
container.style.overflow = '';
|
|
}
|
|
};
|
|
|
|
export function stopScrollInertia(element: HTMLElement) {
|
|
element.style.display = 'none';
|
|
forceReflow(element);
|
|
element.style.display = '';
|
|
}
|
|
|
|
export default resetScroll;
|