Refresh on page when giving resize

0

I have my function to resize,

    function resizeGrid() {
      $(".divGrid").css("height", ($(document).height() - 325) + "px");
    }
    $(resizeGrid);

It works as I would like, but when testing in the browser, I always have to give f5 so that it works, how do I make it when it releases the mouse button after resize, call this function?

    
asked by anonymous 20.08.2014 / 21:55

1 answer

2

There are several possible ways. Here are a few:

Via DOM

window.onresize = function(event) {
    resizeGrid();
};

Via Event Listener

window.addEventListener('resize', function(event){
    resizeGrid();
});

Via jQuery

$(window).resize(function() {
    resizeGrid();
});
    
20.08.2014 / 21:59