title: Page reload sometimes doesn't show a button
body: <p>so right now I'm making a dashboard side-menu that collapse-able and reopen-able. Everything works great, except for one issue. Let's say I collapsed my side-menu, and then start pressing the refresh page over and over, at a speed of about 1 click/sec. About 2/10 of those page reloads will not show up with the button that is supposed to be there. Here's what I got:</p>
  
  <pre><code>$(document).ready(function () {
      $("#home").click(function () {
          "use strict";
          $.cookie('open', false);
          $(this).hide();
          $("#home2").show();
          $("#nav").slideToggle('fast');
          $(".content").animate({marginLeft: "0px"}, 200, function () {});
          $(".content").animate({width: "100%"}, 200, function () {});
      });
  
      $("#home2").click(function () {
          "use strict";
          $.cookie('open', true);
          $(this).hide();
          $("#nav").slideToggle('fast');
          $("#home").show();
          $(".content").animate({marginLeft: "220px"}, 200, function () {});
          $(".content").animate({width: "100%"}, 200, function () {});
      });
  
      if ($.cookie('open') === 'false') {
  
          $("#nav").slideToggle('fast');
          $(".content").animate({marginLeft: "0px"}, 1, function () {});
          $(".content").animate({width: "100%"}, 1, function () {});
          $.cookie('open', false);
          $("#home").hide();
          $("#home2").show();
      }
  });
  </code></pre>
  
  <p>I used cookies to get the state of whether the sidebar menu was up.  When the cookie open == false, then the sidebar is closed, and when cookie open == true, then it is opened. </p>
  
  <p>To give more detail, the ID "home2" is the one that is not showing up some of the times. </p>
  
  <p>Whenever I do a page reload, there's a couple of milliseconds where I can see the </p>
  
  <pre><code>    $("#nav").slideToggle('fast');
      $(".content").animate({marginLeft: "0px"}, 1, function () {});
      $(".content").animate({width: "100%"}, 1, function () {});
  </code></pre>
  
  <p>stuff doing its work. Whenever that happens, the button will show up. But sometimes on the page reloads, the page doesn't do this and it just reloads lightning fast where I can't see the previously mentioned code doing its job; this is when the #home2 button decides not to pop up, which leads me to believe that the stuff in statement is not being performed.</p>
  
  <p>This is such a bizarre problem and I have no idea why it's behaving like this..</p>
  
  <p>EDIT: Changed if statement around to:</p>
  
  <pre><code>if ($.cookie('open') === 'false') {
      $("#home2").show();
      $("#home").hide();
      $(".content").animate({marginLeft: "0px"}, 1, function () {});
      $(".content").animate({width: "100%"}, 1, function () {});
      $.cookie('open', false);
      $("#nav").slideToggle('fast');
  }
  </code></pre>
  
  <p>Still having same problem.</p>