title: Set min-height and min-width on window resize
body: <p>First of all pardon me if this is a duplicate , but I have been trying solutions from other posts but none of them seems to work for me. </p>
  
  <p><strong>This is what I am trying to achieve:</strong></p>
  
  <p>I want to set the min-height and min-width of a div with the current width and height of the document. The Event should trigger on every resize of the document window.</p>
  
  <p><strong>This is what I have tried so far:</strong></p>
  
  <pre><code>$(document).ready(function() {
  
  function reset_demensions() {
      doc_height = $(document).height();
      doc_width = $(document).width();
      $(".flicker-div").css("min-width", doc_width + "px");
      $(".flicker-div").css("min-height", doc_height + "px");
      alert("From - Function" + doc_width + "x" + doc_height);
  
  }
  
      reset_demensions(); 
      $(window).resize(function() {
          reset_demensions();
  
      });
  
  });
  </code></pre>
  
  <p><strong>The problem I am facing:</strong></p>
  
  <p>First time when the window loads it shows me the correct width and height. But when I try to resize the window manually two problems are being noticed:</p>
  
  <p>1> The function is called twice i.e. alert box
  2> The captured height of the document doesn't change.
  3> The captured width of the document keeps increasing rapidly , and the values are not garbage as it's static for every run.</p>
  
  <p><strong>Test Run OUTPUT:</strong></p>
  
  <pre><code>On Load:
  1349x626
  On Resize:
  1369x3130
  1389x15650
  </code></pre>
  
  <p>I am sure I missed something here , might be something very silly. Kindly help me figure this out.</p>