Skip to content

Commit 3359d54

Browse files
Converted footer site navigation to <ul>.
Added .active class to show which page is currently loaded. Added styles to support hover color change and .active class at the same time. Added setActiveLink to javascript file which will change nav elements color based on current page loaded.
1 parent b68131f commit 3359d54

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

_includes/footer.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ <h2 class="footer__section-title">Our Sponsors</h2>
4646
<div class="col-md-3">
4747
<h2 class="footer__section-title">Python Sprints</h2>
4848
<hr class="footer__divider">
49-
<a class="footer__link" href="{{ '/' | prepend: site.baseurl }}">Home</a>
49+
<ul class="pl-0 text-center">
50+
<li><a class="footer__link" href="{{ '/' | prepend: site.baseurl }}">Home</a></li>
5051
{% for page in site.pages %}
5152
{% if page.title %}
52-
<a class="footer__link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
53+
<li><a class="footer__link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a></li>
5354
{% endif %}
5455
{% endfor %}
56+
</ul>
57+
5558
</div>
5659
</div>
5760

_sass/style.scss

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ a {
1717
text-decoration: none !important;
1818
transition: all 0.5s ease-in-out;
1919
&:hover {
20-
color: #A55605;
20+
color: #A55605!important;
2121
}
2222
}
2323

@@ -69,8 +69,8 @@ a {
6969
/*Here I need to move the background image to slide under the navigation*/
7070
/*Any smarter solutions are welcome!*/
7171
.navigation__content {
72-
margin-top: -66px;
7372
background-size: cover;
73+
margin-top: -66px;
7474
max-width: 100vw;
7575
height: 101vh;
7676
}
@@ -203,7 +203,8 @@ a {
203203
}
204204
}
205205

206-
.navigation__overlay .navigation__link {
206+
207+
.navigation__link {
207208
text-decoration: none;
208209
font-size: 2em;
209210
font-family: 'Encode Sans Expanded', sans-serif;
@@ -217,17 +218,17 @@ a {
217218
}
218219

219220
@media (min-width: 768px), (orientation: portrait) {
220-
.navigation__overlay .navigation__link {
221-
padding: 0.25em;
221+
.navigation__link {
222+
padding: 0.25em;
222223
}
223224
}
224225

225226
.navigation__link:hover {
226-
color: #f1f1f1;
227+
color: #f1f1f1!important;
227228
}
228229

229-
.navigation__link:focus {
230-
color: #035e9a;
230+
.active {
231+
color: #035e9a!important;
231232
}
232233

233234
.navigation__button-close-container {
@@ -652,11 +653,9 @@ a {
652653

653654
.footer__link {
654655
margin-top: 2%;
655-
text-align: center;
656656
font-size: 1.25em;
657657
font-family: 'Playfair Display', serif;
658658
color: #7fa0c2;
659-
display: block;
660659
}
661660

662661
.footer__brand-img {

static/js/site.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ function showCloseButton() {
2929
buttonCloseContainer.css("display", "inline");
3030
}
3131

32-
// buttonOpenContainer.on("click", openNav);
33-
// navigationButtonClose.on("click", closeNav);
34-
3532
// Responsive background image constructor.
3633
class ResponsiveBackgroundImage {
3734

@@ -64,4 +61,15 @@ for (let i=0; i<elements.length; i++) {
6461
new ResponsiveBackgroundImage(elements[i]);
6562
}
6663

64+
// Add active class to navigation elements in the navigation overlay and
65+
// footer on page load.
66+
$(setActiveLink());
6767

68+
function setActiveLink() {
69+
var currentURL = window.location.href;
70+
$('.navigation__link, .footer__link').each(function () {
71+
if (this.href === currentURL) {
72+
$(this).addClass('active');
73+
}
74+
});
75+
}

0 commit comments

Comments
 (0)