Skip to content

Instantly share code, notes, and snippets.

@parsakafi
Last active November 4, 2016 22:45
Show Gist options
  • Save parsakafi/77e18eeb23bca4731e01ebbb2211c79a to your computer and use it in GitHub Desktop.
Save parsakafi/77e18eeb23bca4731e01ebbb2211c79a to your computer and use it in GitHub Desktop.
Fix Footer With CSS & Jquery/JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fix Footer With CSS & Jquery/JS</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="public.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<footer class="footer_s">
copyright 2016 PARSA.WS, all rights reserved.
</footer>
</body>
</html>
$(function () {
remove_footer_class();
});
function remove_footer_class() {
if ($("body").height() > $(window).height()) {
$("footer").removeClass("footer_s");
}
}
footer {
background-color: #f8f8fa;
padding: 1.5rem;
color: #9e9ea0;
}
.footer_s {
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment