Skip to content

Commit

Permalink
Affix the footer to the bottom of the screen
Browse files Browse the repository at this point in the history
Fixes #2661
  • Loading branch information
jcoyne committed Jan 11, 2017
1 parent 8cf1f05 commit 5c2ca88
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
30 changes: 30 additions & 0 deletions app/assets/stylesheets/sufia/_footer.scss
@@ -0,0 +1,30 @@
// Styles below keep footer at bottom of viewport
html {
position: relative;
min-height: 100%;
}

body {
margin-bottom: $footer-height + $footer-top-margin;
}

.site-footer {
margin-top: $footer-top-margin;
padding: 10px;

// Styles below keep footer at bottom of viewport
position: absolute;
bottom: 0;
height: $footer-height;
width: 100%;
}

@media (max-width: $screen-sm) {
// make more room in the footer for mobile devices
body {
margin-bottom: 2 * $footer-height + $footer-top-margin;
}
.site-footer {
height: 2 * $footer-height;
}
}
4 changes: 3 additions & 1 deletion app/assets/stylesheets/sufia/_sufia.scss
Expand Up @@ -8,7 +8,8 @@
'sufia/home-page', 'sufia/featured', 'sufia/usage-stats', 'sufia/catalog',
'sufia/buttons', 'sufia/tinymce', 'sufia/proxy-rights', 'sufia/file-show',
'sufia/work-show', 'sufia/modal', 'sufia/form', 'sufia/form-progress',
'sufia/fixedsticky', 'sufia/file_upload', 'sufia/representative-media';
'sufia/fixedsticky', 'sufia/file_upload', 'sufia/representative-media',
'sufia/footer';
@import 'sharing_buttons';

/* This class is to workaround an issue in which Bootstrap requires a div to display a tooltip
Expand All @@ -24,3 +25,4 @@
display: inline-block;
}


3 changes: 3 additions & 0 deletions app/assets/stylesheets/sufia/_variables.scss
Expand Up @@ -12,3 +12,6 @@ $navbar-transparent-link-active-bg: rgba(255, 255, 255, 0.2) !default;
$title-height: 75px !default;
$marketing-text-color: $gray-darker !important;
$marketing-text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1) !important;

$footer-top-margin: 3 * $padding-small-vertical !default;
$footer-height: 118px !default;
2 changes: 1 addition & 1 deletion app/views/shared/_footer.html.erb
@@ -1,4 +1,4 @@
<footer class="navbar navbar-inverse">
<footer class="navbar navbar-inverse site-footer">
<div class="container-fluid">
<div class="navbar-text text-left">
<p>A service of <a href="http://projecthydra.org/" class="navbar-link" target="_blank">Project Hydra</a>.</p>
Expand Down

0 comments on commit 5c2ca88

Please sign in to comment.