Skip to content

Commit

Permalink
Fix sticky footer issue using Jquery
Browse files Browse the repository at this point in the history
Calculates height of footer on page load and on resize and
set bootom padding of body according to it to keep footer at bottom.

Fixes: #36
  • Loading branch information
vikas-parashar committed Feb 16, 2016
1 parent 3b33335 commit ea37c6b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
18 changes: 18 additions & 0 deletions plonetheme/barceloneta/theme/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,23 @@
<footer id="portal-footer-wrapper" role="contentinfo">
<div class="container" id="portal-footer"></div>
</footer>

<!-- STICKY FOOTER -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
function stickyFooter() {
var footerHeight = $('#portal-footer-wrapper').outerHeight()
$('body').css('padding-bottom', footerHeight);
$('footer').css('height', footerHeight);
}

$(document).ready(function(){
stickyFooter();
});

$( window ).resize(function() {
stickyFooter();
});
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions plonetheme/barceloneta/theme/less/barceloneta-compiled.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions plonetheme/barceloneta/theme/less/footer.plone.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
//*// FOOTER //*//

footer{
position: absolute;
left: 0;
bottom: 0;
height: auto;
width: 100%;
}


#portal-footer-wrapper {
padding: 30px 15px;
background-color: @plone-footer-bg;
Expand Down
2 changes: 2 additions & 0 deletions plonetheme/barceloneta/theme/less/scaffolding.plone.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

//*// Body reset
html {
position: relative;
min-height: 100%;
font-size: 62.5%;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
Expand Down

0 comments on commit ea37c6b

Please sign in to comment.