Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
smoothscroll
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
grifart libs
smoothscroll
Commits
d63b0401
Commit
d63b0401
authored
4 years ago
by
Daniel Kurowski
Browse files
Options
Downloads
Patches
Plain Diff
Renamed scrollTo() to scrollToTarget()
parent
35195ccd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Improve structure
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/initializeOnLinkClickScroll.ts
+2
-2
2 additions, 2 deletions
src/initializeOnLinkClickScroll.ts
src/initializeOnLoadScroll.ts
+2
-2
2 additions, 2 deletions
src/initializeOnLoadScroll.ts
src/scrollToTarget.ts
+3
-3
3 additions, 3 deletions
src/scrollToTarget.ts
with
7 additions
and
7 deletions
src/initializeOnLinkClickScroll.ts
+
2
−
2
View file @
d63b0401
import
{
scrollTo
}
from
'
./scrollTo
'
;
import
{
scrollTo
Target
}
from
'
./scrollTo
Target
'
;
import
{
assert
}
from
'
./assert
'
;
import
{
HashTarget
}
from
'
./HashTarget
'
;
...
...
@@ -11,6 +11,6 @@ export function initializeOnLinkClickScroll(): void
assert
(
element
!==
null
);
event
.
preventDefault
();
scrollTo
(
HashTarget
.
fromString
(
element
.
hash
,
document
));
scrollTo
Target
(
HashTarget
.
fromString
(
element
.
hash
,
document
));
})));
}
This diff is collapsed.
Click to expand it.
src/initializeOnLoadScroll.ts
+
2
−
2
View file @
d63b0401
import
{
scrollTo
}
from
'
./scrollTo
'
;
import
{
scrollTo
Target
}
from
'
./scrollTo
Target
'
;
import
{
HashTarget
}
from
'
./HashTarget
'
;
import
{
assert
}
from
'
./assert
'
;
...
...
@@ -36,6 +36,6 @@ export function initializeOnLoadScroll(): void
// Then, scroll down to it smoothly.
assert
(
hashTarget
!==
null
,
'
Hash target should be set on DOM loaded.
'
);
scrollTo
(
hashTarget
);
scrollTo
Target
(
hashTarget
);
});
}
This diff is collapsed.
Click to expand it.
src/scrollTo.ts
→
src/scrollTo
Target
.ts
+
3
−
3
View file @
d63b0401
import
*
as
Velocity
from
'
velocity-animate
'
;
import
{
HashTarget
}
from
'
./HashTarget
'
;
export
function
scrollTo
(
hash
:
HashTarget
):
void
export
function
scrollTo
Target
(
hashTarget
:
HashTarget
):
void
{
Velocity
.
animate
(
hash
.
getElement
(),
'
scroll
'
,
{
Velocity
.
animate
(
hash
Target
.
getElement
(),
'
scroll
'
,
{
duration
:
1200
,
// todo: different depending on offset from page top?
easing
:
'
ease-in-skip-out
'
,
complete
:
()
=>
window
.
location
.
hash
=
hash
.
getHash
(),
complete
:
()
=>
window
.
location
.
hash
=
hash
Target
.
getHash
(),
});
}
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