How to solve the TypeError of undefined functions of jQuery.nicescroll and UniteGallery annoying in PHP files? Is it because of the jQuery version?

0
  • Bootstrap 4.0.0 Beta uses jQuery 3.2.1
  • UniteGallery uses jQuery 11.0
  • jQuery.nicescroll uses jQuery 2

Using PHP

I only use jQuery 3. I do not want to have multiple versions of jQuery. See the order of Javascript files. I did not see any errors in these codes:

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.nicescroll.js"></script>
<script type="text/javascript" src="js/bootstrap.bundle.js"></script>
<script type='text/javascript' src='js/unitegallery.js'></script>   
<script type='text/javascript' src='js/ug-theme-tiles.js'></script>

<script type="text/javascript">
$(document).ready(function() {

  $("html").niceScroll({
    cursorwidth: 12,
    cursoropacitymin: 0.5,
    cursorcolor: '#ff8a80',
    cursorborder: 'none',
    cursorborderradius: 10,
    autohidemode: 'leave',
    horizrailenabled:false
  }); 

  $("#mc-scroll").niceScroll({
    cursorborderradius: 3, 
    cursorcolor:"#1a237e", 
    cursoropacitymin: 0, 
    cursorwidth: "3px", 
    railpadding: { top: 0, left: 0 }
  });

  $("#fotogaleria").unitegallery();

});
</script>

In the file index.php and there is no error in it.

<body>

  <?php include("cabecalho.php") ?>
  <div class="wrapper">
    <div class="container-fluid">
      <div class="row">
<div class="col-md-12">          
          <?php include("fotogaleria.php") ?>          
        </div>
      </div> <!-- row -->
    </div> <!-- container-fluid -->
  </div> <!-- wrapper -->  

  <?php include("rodape.php") ?>

</body>
</html>

In the fotogaleria.php file that is included within indexa.php :

<div id="fotogaleria" style="display:none;">
   <a href="imagens/noivos/noivos1.jpg">
     <img alt="<?php echo _alt_novios1 ?>"
     src="imagens/noivos/noivos1.jpg"
     data-image="imagens/noivos/noivos1.jpg"
     data-description="<?php echo _alt_novios1 ?>"
     style="display:none">
   </a>           
</div>

Here are the errors:

  • In the case of jQuery.nicescroll, but Javascript function codes are correct:

TypeError: self.autohidedom.stop is not a function. (In 'self.autohidedom.stop()', 'self.autohidedom.stop' is undefined)

  • In the case of UniteGallery:

TypeError: undefined is not an object (evaluating '$.easing["swing"]')

The error showed the UniteGallery code line:

(function(factory) { if (typeof define === "function" && define.amd) { define(["jquery"], function($) { return factory($) }) } else if (typeof module === "object" && typeof module.exports === "object") { exports = factory(require("jquery")) } else { factory(jQuery) } })(function($) { $.easing["jswing"] = $.easing["swing"]; var pow = Math.pow,
  • In the case of jQuery caused by UniteGallery:

TypeError: $("#fotogaleria").unitegallery is not a function. (In '$("#fotogaleria").unitegallery()', '$("#fotogaleria").unitegallery' is undefined)

And the jQuery line:

jQuery.readyException = function(error) {
​    window.setTimeout(function() {
​        throw error;
​    });
};
    
asked by anonymous 15.10.2017 / 14:28

0 answers