Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1301060
    pdeluca
    Participant

    Hi, Im trying to achieve this kind of behavior with the footer:

    1) The footer should be visible if the content above it is shorter than the user’s viewport height.
    2) If the content is taller than the user’s viewport height, then the footer should disappear from view and rest at the bottom of the page, as it would naturally.

    Any ideas how to make this happen? URL is http://81c.e86.myftpupload.com/homepage/

    Thanks,
    Pablo.

    #1301065
    pdeluca
    Participant

    This is a sample where the content sometimes doesnt fill the screen so the footer should be at the bottom of it.

    http://81c.e86.myftpupload.com/loch-arbor-project/

    Pablo.

    #1301357
    Lely
    Moderator

    Hello Pablo,

    Please try add the following code on Appearance > Customize > Custom > Edit Global Javascript:

    jQuery(document).ready(function ($) {
        if ($("body").height() < $(window).height()) {
         $('.x-colophon.bottom').css({'position':'fixed', 'width':'100%'});
        }
    });

    Hope this helps.

    #1301932
    pdeluca
    Participant

    Thanks Lely. I tried that piece of code but unfortunately it didnt work.

    Pablo.

    #1302102
    Nico
    Moderator

    Hi There,

    In this case, would you mind sharing us your admin credentials in private reply.

    Don’t forget to set it as private reply.

    Thanks.

    #1302995
    pdeluca
    Participant
    This reply has been marked as private.
    #1303310
    Rad
    Moderator

    Hi there,

    I tried it and credentials are not correct. Please provide the latest one.

    Thanks!

    #1305227
    pdeluca
    Participant
    This reply has been marked as private.
    #1305357
    Paul R
    Moderator

    Hi Pablo,

    You can try this code instead.

    
    jQuery( document ).ready(function($) {
    $(window).on("resize", function () {    
        var adminbarHeight = $('#wpadminbar').height();
        
        var windowHeight   = $( window ).height();
        var mastheadHeight = $('.masthead').outerHeight();
        var landmarkHeight = $('.x-header-landmark').outerHeight();
        var footerHeight  = $('.x-colophon.top').outerHeight();
        var subHeight = mastheadHeight + footerHeight + landmarkHeight + adminbarHeight;
        var contentHeight  = windowHeight -  subHeight; 
        $('.x-main').css('min-height',contentHeight);
    }).resize();
    });
    

    Hope that helps

    #1306153
    pdeluca
    Participant

    Hi Paul, it seems that piece of code worked very well.

    Thanks,
    Pablo.

    #1306160
    Joao
    Moderator

    Glad to hear it 🙂

    Joao

  • <script> jQuery(function($){ $("#no-reply-1301060 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>