Skip to content

Improve loading of foundation, foundationExtendEBI, script.js

Created by: khawkins98

There's an opportunity to simplify the boilerplate code by self-inoking the Foundation JS at the bottom of foundationExtendEBI.js.

This would allow us to remove:

  <script type="text/JavaScript">$(document).foundation();</script>
  <script type="text/JavaScript">$(document).foundationExtendEBI();</script>

It would also potentially allow us to use the defer attribute on the loading of foundation.js and foundationExtendEBI.js -- which would improve the page interaction time.

At present I don't see a downside to doing this, as users of foundationExtendEBI.js will need to have jQuery and Foundation. Only possible downside would be if a site has other complex foundation extensions ... that could perhaps be overcome by setting a body class to not self invoke, say body.no-self-invoke-foundation