title: jQuery: Slide panel delay on load
body: <p>I have been working on a side panel that is expanded on page load, slides closed on click and uses a cookie to stay closed on refresh, what I have works great.</p>
  
  <p><a href="https://jsfiddle.net/u8ccv03s/14/" rel="nofollow">Fiddle</a></p>
  
  <pre><code>$('#slideClick').click(function () {
  var it = $(this).data('it') || 2;
  switch (it) {
  
      case 2:
          $(this).parent().animate({
              right: '-345px'
          }, {
              queue: false,
              duration: 500
          });
          $(".slideClose").addClass('hideBtn');
          $(".slideOpen").removeClass('hideBtn');
          break;
  
      case 1:
          $(this).parent().animate({
              right: '+=345px'
          }, {
              queue: false,
              duration: 500
          });
          $(".slideOpen").addClass('hideBtn');
          $(".slideClose").removeClass('hideBtn');
          break;
  
  }
  it++;
  if (it &gt; 2) it = 1;
  $(this).data('it', it);
  //$.cookie('myCookieName', '1')
  var date = new Date();
  var minutes = 1;
  date.setTime(date.getTime() + (minutes * 60 * 1000));
  $.cookie("myCookieName", "foo", { expires: date });
  });
  </code></pre>
  
  <p>If possible id like the panel to be closed on load and expand/slide out after 2 seconds, I have tried modifying "case 1:" and ended up breaking it repetitively as this is outside of my jQuery knowledge, any help would be appreciated.</p>
  
  <p><strong>update</strong> I tried using ".delay(2000)" before .animate with no luck.</p>
  
  <p>Thanks </p>