Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LINAGORA
L
LGS
Labs
voice-web
Commits
0282e94b
Commit
0282e94b
authored
Sep 27, 2017
by
Michael Henretty
Browse files
fix scrolling to top on desktop when changing pages, fixes #311
parent
91b27102
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
web/src/lib/components/pages.tsx
web/src/lib/components/pages.tsx
+18
-6
No files found.
web/src/lib/components/pages.tsx
View file @
0282e94b
...
...
@@ -296,12 +296,24 @@ export default class Pages extends Component<PagesProps, PagesState> {
var
self
=
this
;
this
.
content
.
addEventListener
(
'
transitionend
'
,
function
remove
()
{
self
.
content
.
removeEventListener
(
'
transitionend
'
,
remove
);
self
.
scroller
.
scrollTop
=
0
;
// scroll back to the top of the page
self
.
setState
({
currentPage
:
nextProps
.
currentPage
,
pageTransitioning
:
false
,
isMenuVisible
:
false
,
});
// After changing pages we will scroll to the top, which
// is accomplished differentonly on mobile vs. desktop.
self
.
scroller
.
scrollTop
=
0
;
// Scroll up on mobile.
self
.
setState
(
{
currentPage
:
nextProps
.
currentPage
,
pageTransitioning
:
false
,
isMenuVisible
:
false
,
},
()
=>
{
// Scroll to top on desktop.
window
.
scrollTo
({
top
:
0
,
behavior
:
'
smooth
'
,
});
}
);
});
this
.
setState
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment