מכירים את זה שאין בעמוד מספיק תוכן והפוטר לא דבוק לתחתית?
הקוד הבא יצמיד את הפוטר לתחתית גם במקרה שאין מספיק תוכן באתר,
בשלב הראשון תוסיפו את הקלאס sticky-footer לקונטיינר הראשי בפוטר,
בשלב הבא הוסיפו ווידג'ט HTML והכניסו את הקוד הבא:
JavaScript
<script>jQuery(document).ready(function($) {
// Check if the page has less content
function stickFooter() {
var windowHeight = $(window).height();
var bodyHeight = $('body').height();
var footerHeight = $('.sticky-footer').outerHeight();
if (bodyHeight < windowHeight) {
$('.sticky-footer').css('position', 'fixed').css('bottom', '0');
} else {
$('.sticky-footer').css('position', 'static');
}
}
// Call the stickFooter function on page load and window resize
$(window).on('load resize', function() {
stickFooter();
});
});
</script>