Search code examples
javascriptjqueryimpresspages

Slider Widget (AsdSlider) causes Javascript Error on website


Using the plugin Slider Widget (AsdSlider) I get this error in the console of any browser. It happens on all pages which don't include a placed AsdSlider content element:

Uncaught ReferenceError: asdSliderList is not defined 

More details:

  (anonymous function) in contactpage:274
  j              ipCore.min.js?8:53
  k.fireWith     ipCore.min.js?8:55
  n.extend.ready ipCore.min.js?8:55
  I              ipCore.min.js?8:55

Does anybody have an idea what this could be? This causes following plugins to stop working.

Looks like this definiton in the plugin does not work:

<?php
namespace Plugin\AsdSlider;

class Event {
  public static function ipBeforeController() {
    ...
    if( !ipIsManagementState() ) {
      $script = "
        $(document).ready(function() {
          if( asdSliderList != undefined && asdSliderList.length > 0 ) {
            $.each( asdSliderList, function( key, value ) {
              $( value.id ).bxSlider( value.options );
            });
          }
        });
      "; 
      ipAddJsContent('asdslider', $script);
    }
  }
}

The problem was there with IP 4.2.2 to 4.2.6

Thank you!


Solution

  • With latest update I fixed that bug. You can update plugin or update one line by yourself in Event.php

    asdSliderList != undefined
    

    to

    typeof asdSliderList != 'undefined'