Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
1972b2ce
Commit
1972b2ce
authored
4 years ago
by
Reiter, Christoph
Browse files
Options
Downloads
Plain Diff
Merge branch 'app-shell-scroll-to-activity-top-improvement' into 'master'
Improve scroll to top behaviour See merge request
!25
parents
3359d8fe
c7897cfd
No related branches found
No related tags found
1 merge request
!25
Improve scroll to top behaviour
Pipeline
#15645
passed
4 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/app-shell/src/app-shell.js
+22
-3
22 additions, 3 deletions
packages/app-shell/src/app-shell.js
with
22 additions
and
3 deletions
packages/app-shell/src/app-shell.js
+
22
−
3
View file @
1972b2ce
...
@@ -348,6 +348,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
...
@@ -348,6 +348,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
}
}
switchComponent
(
componentTag
)
{
switchComponent
(
componentTag
)
{
let
offset
=
window
.
pageYOffset
;
const
changed
=
(
componentTag
!==
this
.
activeView
);
const
changed
=
(
componentTag
!==
this
.
activeView
);
this
.
activeView
=
componentTag
;
this
.
activeView
=
componentTag
;
if
(
changed
)
if
(
changed
)
...
@@ -359,8 +360,27 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
...
@@ -359,8 +360,27 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
}
}
let
updateFunc
=
()
=>
{
let
updateFunc
=
()
=>
{
if
(
window
.
pageYOffset
!==
0
)
{
window
.
scrollTo
(
0
,
96
);
if
(
offset
>
0
)
{
const
header
=
this
.
shadowRoot
.
querySelector
(
"
header
"
);
const
title
=
this
.
shadowRoot
.
querySelector
(
"
#headline
"
);
if
(
header
===
null
||
title
===
null
)
{
return
;
}
let
style
=
getComputedStyle
(
title
);
let
marginTop
=
isNaN
(
parseInt
(
style
.
marginTop
,
10
))
?
0
:
parseInt
(
style
.
marginTop
,
10
);
let
marginBottom
=
isNaN
(
parseInt
(
style
.
marginBottom
,
10
))
?
0
:
parseInt
(
style
.
marginBottom
,
10
);
let
topValue
=
header
.
getBoundingClientRect
().
height
+
title
.
getBoundingClientRect
().
height
+
marginTop
+
marginBottom
;
if
(
offset
<
topValue
)
{
window
.
scrollTo
(
0
,
offset
);
}
else
{
window
.
scrollTo
(
0
,
topValue
);
}
}
}
this
.
updatePageTitle
();
this
.
updatePageTitle
();
this
.
subtitle
=
this
.
activeMetaDataText
(
"
short_name
"
);
this
.
subtitle
=
this
.
activeMetaDataText
(
"
short_name
"
);
...
@@ -811,7 +831,6 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
...
@@ -811,7 +831,6 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
<dbp-tugraz-logo id="main-logo" lang="
${
this
.
lang
}
" class="
${
classMap
({
hidden
:
this
.
noBrand
})}
"></dbp-tugraz-logo>
<dbp-tugraz-logo id="main-logo" lang="
${
this
.
lang
}
" class="
${
classMap
({
hidden
:
this
.
noBrand
})}
"></dbp-tugraz-logo>
</div>
</div>
</header>
</header>
<div id="headline">
<div id="headline">
<h1 class="title">
${
this
.
topicMetaDataText
(
'
name
'
)}
</h1>
<h1 class="title">
${
this
.
topicMetaDataText
(
'
name
'
)}
</h1>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment