Add scroll to top on navbar press
This commit is contained in:
parent
e5c62c99b1
commit
d30fdd40dc
2 changed files with 11 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
<header id="header" {{ if .IsHome }}class="alt"{{ end }}>
|
<header id="header" {{ if .IsHome }}class="alt"{{ end }}>
|
||||||
<h1><a href="/">{{ title .Site.Title }}</a></h1>
|
<h1><a href="/" class="navbar-brand">{{ title .Site.Title }}</a></h1>
|
||||||
<nav id="nav">
|
<nav id="nav">
|
||||||
<ul>
|
<ul>
|
||||||
{{ $home := .Site.GetPage "home" }}
|
{{ $home := .Site.GetPage "home" }}
|
||||||
|
|
|
@ -31,3 +31,13 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.navbar-brand').bind('click', function (event) {
|
||||||
|
if ($('html').scrollTop() > 100) {
|
||||||
|
$('html, body').stop().animate({
|
||||||
|
scrollTop: 0
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
window.location = '/';
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue