Skip to content

Commit b428556

Browse files
authored
Merge pull request academicpages#110 from yimingzhaomath/master
Added sticky footer
2 parents 63f279a + 8068eb5 commit b428556

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

_sass/_base.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
/* ==========================================================================
22
BASE ELEMENTS
33
========================================================================== */
4+
html {
5+
/* sticky footer fix */
6+
position: relative;
7+
min-height: 100%;
8+
}
49

510
body {
611
margin: 0;
712
padding: 0;
13+
padding-bottom: 9em;
814
color: $text-color;
915
font-family: $global-font-family;
1016
line-height: 1.5;
@@ -306,4 +312,4 @@ nav {
306312
b, i, strong, em, blockquote, p, q, span, figure, img, h1, h2, header, input, a, tr, td, form button, input[type="submit"], .btn, .highlight, .archive__item-teaser {
307313
-webkit-transition: $global-transition;
308314
transition: $global-transition;
309-
}
315+
}

_sass/_footer.scss

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
========================================================================== */
44

55
.page__footer {
6-
@include full();
76
@include clearfix;
7+
float: left;
8+
margin-left: 0;
9+
margin-right: 0;
10+
width: 100%;
11+
clear: both;
12+
/* sticky footer fix start */
13+
position: absolute;
14+
bottom: 0em;
15+
height: auto;
16+
/* sticky footer fix end */
817
margin-top: 3em;
918
color: mix(#fff, $gray, 25%);
1019
-webkit-animation: intro 0.3s both;
@@ -15,9 +24,11 @@
1524
border-top: 1px solid $light-gray;
1625

1726
footer {
18-
@include container;
1927
@include clearfix;
28+
margin-left: auto;
29+
margin-right: auto;
2030
margin-top: 2em;
31+
max-width: 100%;
2132
padding: 0 1em 2em;
2233

2334
@include breakpoint($x-large) {
@@ -34,7 +45,10 @@
3445
}
3546
}
3647

37-
.fa {
48+
.fas,
49+
.fab,
50+
.far,
51+
.fal {
3852
color: mix(#fff, $gray, 25%);
3953
}
4054
}
@@ -45,7 +59,6 @@
4559
}
4660

4761
.page__footer-follow {
48-
4962
ul {
5063
margin: 0;
5164
padding: 0;
@@ -70,4 +83,10 @@
7083
padding-right: 10px;
7184
font-weight: bold;
7285
}
73-
}
86+
87+
.social-icons {
88+
a {
89+
white-space: nowrap;
90+
}
91+
}
92+
}

assets/js/_main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,23 @@
33
========================================================================== */
44

55
$(document).ready(function(){
6+
// Sticky footer
7+
var bumpIt = function() {
8+
$("body").css("margin-bottom", $(".page__footer").outerHeight(true));
9+
},
10+
didResize = false;
11+
12+
bumpIt();
613

14+
$(window).resize(function() {
15+
didResize = true;
16+
});
17+
setInterval(function() {
18+
if (didResize) {
19+
didResize = false;
20+
bumpIt();
21+
}
22+
}, 250);
723
// FitVids init
824
$("#main").fitVids();
925

0 commit comments

Comments
 (0)