title: Javascript only loads after refresh (Squarespace)
body: <p>I have a javascript running on a squarespace site, but it only seems to work after the page has been refreshed once.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
      $(document).ready(function(){
      $('.markdown-block .sqs-block-content h2').addClass('ui-closed').css('cursor','pointer');
      $(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle();
      $(".markdown-block .sqs-block-content h2").click(function() {
        
        $(this).nextUntil("h2").slideToggle();
        $(this).toggleClass('ui-closed ui-open');
        });
      });
      &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>