Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EBI-Framework
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ebiwd
EBI-Framework
Commits
a0cb0e2e
Commit
a0cb0e2e
authored
7 years ago
by
khawkins98
Browse files
Options
Downloads
Patches
Plain Diff
attempt to better handle anchor links on page load
for #122
parent
4ad701e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/foundationExtendEBI.js
+22
-12
22 additions, 12 deletions
js/foundationExtendEBI.js
with
22 additions
and
12 deletions
js/foundationExtendEBI.js
+
22
−
12
View file @
a0cb0e2e
...
...
@@ -264,24 +264,34 @@ function activateEMBLdropdown(options) {
*/
function
smoothScrollAnchorLinksEBI
()
{
(
function
(
$
)
{
function
ebiSmoothScroll
(
hash
)
{
var
target
=
$
(
hash
),
targetName
=
hash
;
target
=
target
.
length
?
target
:
$
(
'
[name=
'
+
targetName
.
slice
(
1
)
+
'
]
'
);
if
(
target
.
length
)
{
$
(
'
html,body
'
).
animate
({
scrollTop
:
target
.
offset
().
top
-
50
},
{
duration
:
1000
,
complete
:
function
(){
window
.
location
.
hash
=
targetName
;
}
});
return
false
;
}
}
// if there's an active anchor in the url, scroll to it
if
(
window
.
location
.
hash
.
length
>
0
)
{
ebiSmoothScroll
(
window
.
location
.
hash
);
}
// handle clicks within the domain
$
(
'
a[href*=
\\
#]:not([href=
\\
#])
'
).
on
(
'
click
'
,
function
()
{
// Table compatibility
if
(
$
(
this
).
parent
().
parent
().
hasClass
(
'
tabs
'
))
{
return
true
;
//exit
}
if
(
location
.
pathname
.
replace
(
/^
\/
/
,
''
)
==
this
.
pathname
.
replace
(
/^
\/
/
,
''
)
&&
location
.
hostname
==
this
.
hostname
)
{
var
target
=
$
(
this
.
hash
),
targetName
=
this
.
hash
;
target
=
target
.
length
?
target
:
$
(
'
[name=
'
+
this
.
hash
.
slice
(
1
)
+
'
]
'
);
if
(
target
.
length
)
{
$
(
'
html,body
'
).
animate
({
scrollTop
:
target
.
offset
().
top
-
40
},
{
duration
:
1000
,
complete
:
function
(){
window
.
location
.
hash
=
targetName
;
}
});
return
false
;
}
ebiSmoothScroll
(
this
.
hash
);
}
});
}(
jQuery
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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