We are launching a Magento 2.1.3 site, and finding that the site will sometimes load all of its Javascript components and dependencies properly, but sometimes fails to load, in which case a slider is not displayed and the console log shows error messages such as "Uncaught TypeError: $(...).swMegamenu is not a function".
How would we go about troubleshooting and resolving the source of these issues?
<script type="text/javascript"> require([ 'jquery', 'Smartwave_Megamenu/js/sw_megamenu' ], function ($) { $(".sw-megamenu").swMegamenu(); }); </script>