JavaScript RequireJS sporadic failure

I'm working on a Magento2 site. Magento2 uses requirejs and the theme I'm using makes use of it as well. Part of the theme uses Owl Carousel. The code used to load the carousel was originally

require(['jquery', 'owl.carousel/owl.carousel.min'], function($) {
    $("#banner-slider-demo-1").owlCarousel({
        // carousel settings
    });
});

However I noticed sometimes when I load the homepage (where the carousel is used) the carousel doesn't display, and there are errors in the console

Uncaught TypeError: $(...).owlCarousel is not a function

Thinking jQuery might not be loaded, I changed the require code to serialize the requirements

require(['jquery'], function($) {
    require(['owl.carousel/owl.carousel.min'], function () {
        $("#banner-slider-demo-1").owlCarousel({
            // ...

but this had no effect... Sometimes the carousel loads and there are no errors, other times there are errors and it doesn't load.

Even when there is an error the carousel file has been fetched by the browser. It also seems require has loaded the carousel script per developer tools

Developer Tools

Any idea what could be going on?

Answer:1

I recently was searching after a countdown script that count down to a specific day, hour and minute and reset again after it reached the time. Now a week later i see a major issue in the script. The ...

I recently was searching after a countdown script that count down to a specific day, hour and minute and reset again after it reached the time. Now a week later i see a major issue in the script. The ...

I am trying to execute a function inside ng-change every time a check box is clicked.I need to get the value of model or somehow know which check box was clicked so that I can call another ...

I am trying to execute a function inside ng-change every time a check box is clicked.I need to get the value of model or somehow know which check box was clicked so that I can call another ...

  1. ng-change inside ng-repeat
  2. checkbox change event inside repeater
  3. ng-change with ng-repeat
  4. ng-change in ng-repeat
  5. ng-change on ng-repeat

http://bluefaqs.com/2016/02/how-to-animate-a-map-location-marker-with-css/ shows a pulsating GPS location blue dot (at the bottom of that page). Does anyone know how such a particular CSS animation ...

http://bluefaqs.com/2016/02/how-to-animate-a-map-location-marker-with-css/ shows a pulsating GPS location blue dot (at the bottom of that page). Does anyone know how such a particular CSS animation ...

  1. animate google marker android
  2. google marker animation
  3. animate marker google maps android
  4. animate marker google maps
  5. animate marker google maps javascript
  6. animate marker google maps swift
  7. animate marker google maps ios
  8. animate marker google maps android github
  9. animate marker on google map with current location

I have a code like this $(".class1 .class2").on('click', function(){ //Do something }); I am trying to somehting like this using variables: var1=".class1"; var2=".class2" $(var1 var2).on('...

I have a code like this $(".class1 .class2").on('click', function(){ //Do something }); I am trying to somehting like this using variables: var1=".class1"; var2=".class2" $(var1 var2).on('...

  1. multiple variables jquery
  2. multiple var jquery
  3. multiple values jquery
  4. append multiple variables jquery
  5. select multiple variables jquery
  6. declare multiple variables jquery
  7. passing multiple variables jquery ajax
  8. return multiple variables jquery
  9. define multiple variables jquery
  10. alert multiple variables jquery
  11. hide multiple variables jquery
  12. multiple selector variables jquery