mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
Highlight active navigation item + various improvements.
Highlight active navigation item using Scrollspy. Prevent navbar hiding initial content when jumping to in-page anchor. Use material style for navbar shadow. Change color of links in alert boxes for better visibility.
This commit is contained in:
parent
93b66d3058
commit
ee331055ef
6 changed files with 71 additions and 11 deletions
|
@ -85,7 +85,7 @@ googleAnalytics = ""
|
|||
|
||||
[[menu.main]]
|
||||
name = "Home"
|
||||
url = "#top"
|
||||
url = "#bio"
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
|
|
|
@ -43,4 +43,4 @@ weight = 0
|
|||
|
||||
Lena Smith is a professor of artificial intelligence at the Stanford AI Lab. Her research interests include distributed robotics, mobile computing and programmable matter. She leads the Robotic Neurobiology group, which develops self-reconfiguring robots, systems of self-organizing robots, and mobile sensor networks.
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate. Etiam iaculis libero hendrerit ipsum tempus accumsan. Praesent ex justo, aliquam bibendum nulla in, vehicula rhoncus massa. Fusce gravida mattis tellus vel commodo. Etiam molestie non ligula ac venenatis. Integer semper diam at fringilla dapibus. Nunc tincidunt lacinia nisi, sed blandit purus fermentum vel. Morbi tempus dolor dolor. Phasellus scelerisque est elit, et porttitor mauris faucibus sit amet. Phasellus sollicitudin bibendum sem eu blandit. Curabitur congue felis eu velit faucibus porta. Curabitur a pharetra diam.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed neque elit, tristique placerat feugiat ac, facilisis vitae arcu. Proin eget egestas augue. Praesent ut sem nec arcu pellentesque aliquet. Duis dapibus diam vel metus tempus vulputate.
|
||||
|
|
|
@ -33,4 +33,4 @@
|
|||
<title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }}</title>
|
||||
|
||||
</head>
|
||||
<body id="top">
|
||||
<body id="top" data-spy="scroll" data-target="#navbar-main" data-offset="71">
|
||||
|
|
|
@ -14,12 +14,16 @@
|
|||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="#navbar-collapse-1">
|
||||
<div class="collapse navbar-collapse">
|
||||
|
||||
<!-- Left Nav Bar -->
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{ range .Site.Menus.main }}
|
||||
<li class="nav-item"><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||
<li class="nav-item">
|
||||
<a href="{{ .URL | relURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}>
|
||||
{{ .Name }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -605,26 +605,40 @@ footer a#back_to_top i {
|
|||
min-height: 70px !important;
|
||||
}
|
||||
|
||||
/* Prevent navbar hiding initial content when jumping to in-page anchor. */
|
||||
*[id]:before {
|
||||
display: block;
|
||||
content: " ";
|
||||
margin-top: -70px;
|
||||
height: 70px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.navbar-default {
|
||||
background: #fff;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: 0 0.125rem 0.25rem 0 rgba(0,0,0,.11)
|
||||
}
|
||||
|
||||
nav#navbar-main li {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.navbar-default .navbar-nav li a,
|
||||
.navbar-default .navbar-nav li a:visited {
|
||||
.navbar-default .navbar-nav>li>a,
|
||||
.navbar-default .navbar-nav>a:focus,
|
||||
.navbar-default .navbar-nav>a:hover {
|
||||
white-space: nowrap;
|
||||
-webkit-transition: 0.2s ease;
|
||||
transition: 0.2s ease;
|
||||
color: #565a5f;
|
||||
color: #34495e;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.navbar-default .navbar-nav li a:hover {
|
||||
.navbar-default .navbar-nav>.active>a,
|
||||
.navbar-default .navbar-nav>.active>a:focus,
|
||||
.navbar-default .navbar-nav>.active>a:hover {
|
||||
color: #0095eb;
|
||||
font-weight: 700;
|
||||
background-color: transparent !important; /* Override Bootstrap. */
|
||||
}
|
||||
|
||||
.navbar-brand,
|
||||
|
@ -647,6 +661,12 @@ nav#navbar-main li {
|
|||
min-height: 50px !important;
|
||||
}
|
||||
|
||||
/* Prevent navbar hiding initial content when jumping to in-page anchor. */
|
||||
*[id]:before {
|
||||
margin-top: -50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.navbar-brand,
|
||||
.navbar-nav li a {
|
||||
height: inherit;
|
||||
|
@ -795,6 +815,18 @@ div.alert-warning p:first-child::before {
|
|||
content: '\f071';
|
||||
}
|
||||
|
||||
div.alert a {
|
||||
color: rgba(255,255,255,0.9);
|
||||
text-decoration: none;
|
||||
border-bottom: solid 1px #e4e4e4;
|
||||
transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
div.alert a:hover {
|
||||
border-bottom-color: transparent;
|
||||
color: rgba(255,255,255,0.5) !important;
|
||||
}
|
||||
|
||||
.alert-note {
|
||||
color: #fff;
|
||||
background-color: #03A9F4; /* Material LightBlue500 */
|
||||
|
|
|
@ -103,6 +103,30 @@
|
|||
window.location.hash = ""
|
||||
}
|
||||
|
||||
// Initialize Scrollspy.
|
||||
var $body = $('body');
|
||||
var $navbar = $('.navbar-header');
|
||||
var navbar_offset = $navbar.innerHeight() + 1;
|
||||
$body.scrollspy({offset: navbar_offset });
|
||||
|
||||
// Make Scrollspy responsive.
|
||||
function fixScrollspy() {
|
||||
var data = $body.data('bs.scrollspy');
|
||||
if (data) {
|
||||
navbar_offset = $navbar.innerHeight() + 1;
|
||||
data.options.offset = navbar_offset;
|
||||
$body.data('bs.scrollspy', data);
|
||||
$body.scrollspy('refresh');
|
||||
}
|
||||
}
|
||||
|
||||
// Call `fixScrollspy` when window is resized.
|
||||
var resizeTimer;
|
||||
$(window).resize(function() {
|
||||
clearTimeout(resizeTimer);
|
||||
resizeTimer = setTimeout(fixScrollspy, 200);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue