How to make Footer stand in the footer after using AJAX?

3

I have already made several applications and have always used the method below to regulate the height of footer . Always using Bootstrap.

HTML

<div id="footer">
  <div class="navbar navbar-fixed-bottom">
     <div id="rodape">Hi-Nutrition 2014</div>
  </div>
</div>  

CSS

#footer .navbar{
  position: absolute !important;
}

#rodape{
  text-align:center;
  background:#a3a3a3;
  color:white;
  bottom:0;
  position:absolute;
  width:100%;
  margin-bottom:0;
}

But this time it is not working. How could I be doing to keep my footer at the bottom of the page?

Maybe the problem is that in this project I'm working with loading PartialView via AJAX.

SCRIPT

 function Open(url) {
        Carregar();
        url = '@Url.Content("~/")' + url;
        $.ajax({
            url: url,
            type: 'GET',
            success: function (response) {
                $('#corpoConteudo').html(response);
                $('#loader').remove();
            },
            error: function () {
                alert('Ocorreu um erro!');
                $('#loader').remove();
            }
        });
    }

    function Carregar() {
        $('#corpoConteudo').append('<div id="loader"></div>');
    }

This script loads PartialView into <div id="corpoConteudo"></div> and after that element, I'm calling my footer.

    <div class="container">
       <div id="corpoConteudo"></div>
       </div>
    </div>
    <div id="footer">
       Hi-Nutrition 2014
    </div>   

That is, I believe that by loading only a portion of the code, let's say my container with position:relative does not push the footer down.

Any solution?

    
asked by anonymous 19.08.2014 / 18:44

1 answer

4

Good afternoon Rafael, you probably forgot (I do not know how to use technical language) but probably gave white and did not remember that a position:absolute is always accompanied by a parent encapsulator with position:relative and then just determine for your footer the property bottom:0 in CSS as I demonstrated in the example that follows the link below:

link

I put a height for the example in the link but anyway its footer independent whether it has CSS property or not, will always be positioned at the bottom of your page.

Hugs.

    
19.08.2014 / 19:12