{"id":7447040,"date":"2016-06-04T13:29:48","date_gmt":"2016-06-04T13:29:48","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wait-for-window-load-to-addexpandcollapse\/"},"modified":"2016-08-31T18:45:36","modified_gmt":"2016-08-31T18:45:36","slug":"wait-for-window-load-to-addexpandcollapse","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wait-for-window-load-to-addexpandcollapse\/","title":{"rendered":"Wait for window load to addExpandCollapse()"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I have moved my jQuery to the footer of my website to eliminate render-blocking scripts, but that causes your expanding archives plugin to fail.  A simple fix is to add an eventlistener to window.load, in lines 141-142 in your plugin file collapsArch.php:<\/p>\n<pre><code>echo &quot;window.addEventListener(&#039;load&#039;,function(){addExpandCollapse(&#039;widget-collapsarch-$number-top&#039;,&quot; .\n   &quot;&#039;$expandSym&#039;, &#039;$collapseSym&#039;, &quot; . $accordion . &quot;);},false);&quot;;<\/code><\/pre>\n<p>https:\/\/wordpress.org\/plugins\/collapsing-archives\/<\/p>\n","protected":false},"template":"","class_list":["post-7447040","topic","type-topic","status-publish","hentry","topic-tag-jquery","topic-tag-onload"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7447040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7447040\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7447040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}