title: jQuery only works after browser refresh on local Rails project
body: <p>I have both of these jQuery functions, which work fine if I refresh the browser window... But if I simply click through the site, jQuery below does not execute. I am not getting any console errors. I have tried wrapping it in both <code>$(window).on('load', function() { ... }</code> and <code>$(function(){ ... }</code>. I have also tried wrapping each individually like so: <code>$( ".accordion" ).on('load', function() { ... }</code>.</p>
  
  <p>Any ideas would be at all appreciated since this is my first project in the Rails ecosystem. </p>
  
  <pre><code>// grow hover for landing page 
  $(window).bind("resize",function(){
      console.log($(this).width());
      if($(this).width() &lt;1024){
          $('div.causeBox').addClass('grow')
      }
      else{
          $('div.causeBox').removeClass('grow')
      }
  })
  
  // accordion animation
  var acc = document.getElementsByClassName("accordion");
  var i;
  
  for (i = 0; i &lt; acc.length; i++) {
      acc[i].onclick = function() {
          this.classList.toggle("active");
          var panel = this.nextElementSibling;
          if (panel.style.maxHeight){
              panel.style.maxHeight = null;
          } else {
              panel.style.maxHeight = panel.scrollHeight + "px";
          }
      }
  }
  </code></pre>
  
  <p>Is this an issue with my jQuery? Is this something strange about my local environment that I haven't run into before? Thanks for any suggestions.</p>