Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SWLab UI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
SWD
SWLab UI
Commits
3769b685
Commit
3769b685
authored
Jul 01, 2024
by
minseok.park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test -- remove log & update scrollItemToMidpoint fn
parent
7f3d36cc
Pipeline
#19692
passed with stages
in 3 minutes and 20 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
01-nav.js
src/js/01-nav.js
+1
-8
No files found.
src/js/01-nav.js
View file @
3769b685
...
@@ -159,15 +159,8 @@
...
@@ -159,15 +159,8 @@
function
scrollItemToMidpoint
(
panel
,
el
)
{
function
scrollItemToMidpoint
(
panel
,
el
)
{
var
rect
=
panel
.
getBoundingClientRect
()
var
rect
=
panel
.
getBoundingClientRect
()
var
effectiveHeight
=
rect
.
height
var
effectiveHeight
=
rect
.
height
var
navStyle
=
window
.
getComputedStyle
(
nav
)
var
navStyle
=
window
.
getComputedStyle
(
panel
)
console
.
log
(
'panel height >>>>> '
,
effectiveHeight
)
console
.
log
(
'el hight >>>>> '
,
el
.
getBoundingClientRect
().
height
)
console
.
log
(
'calculated top >>>>> '
,
Math
.
max
(
0
,
(
el
.
getBoundingClientRect
().
height
-
effectiveHeight
)
*
0.5
+
el
.
offsetTop
))
if
(
navStyle
.
position
===
'sticky'
)
effectiveHeight
-=
rect
.
top
-
parseFloat
(
navStyle
.
top
)
if
(
navStyle
.
position
===
'sticky'
)
effectiveHeight
-=
rect
.
top
-
parseFloat
(
navStyle
.
top
)
console
.
log
(
'rect top >>>>> '
,
rect
.
top
)
console
.
log
(
'navStyle top >>>>> '
,
parseFloat
(
navStyle
.
top
))
console
.
log
(
'calculated panel height >>>>> '
,
effectiveHeight
)
panel
.
scrollTop
=
Math
.
max
(
0
,
(
el
.
getBoundingClientRect
().
height
-
effectiveHeight
)
*
0.5
+
el
.
offsetTop
)
panel
.
scrollTop
=
Math
.
max
(
0
,
(
el
.
getBoundingClientRect
().
height
-
effectiveHeight
)
*
0.5
+
el
.
offsetTop
)
}
}
...
...
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