0

I am using jquery to stick footer to the bottom. The code works, but when the browser is resized it needs to refresh for the footer to stick to the bottom. I dont want it to need to be refreshed. I tried using the jquery resize method but it doesnt work.

My code is:

$(document).ready(function() {
          var bodyHeight = $("body").height();
          var vwptHeight = $(window).height();
          if (vwptHeight > bodyHeight) {
            $("#footer").css("position","absolute").css("bottom",0);
          }

            $(window).resize(function() {
                $("#footer").css("position","absolute").css("bottom",0);
            });

        });
4

0 回答 0