How to resolve Typeerror undefined functions of jQuery.nicescroll and Unitegallery annoyed in PHP files? Is it because of jQuery version?

Asked

Viewed 53 times

0

  • Bootstrap 4.0.0 Beta uses jQuery 3.2.1
  • Unitegallery uses jQuery 11.0
  • jQuery.nicescroll uses jQuery 2

PHP use

I only use jQuery 3. I don’t want to have multiple versions of jQuery. See the Javascript file order. I didn’t 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’s no mistake 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 file fotogaleria.php which is included within the 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 mistakes:

  • In the case of jQuery.nicescroll, but the 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"]')

Error showed 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;
​    });
};
  • How are the call orders to the archives JS? the first line calls the JQuery and libraries in sequence? or are mixed? in the documentation of the UniteGallery usa jQuery 11.0 and jQuery.nicescroll usa jQuery 2 has no dependencies on other versions of JQuery, by the error presented the data are undefined, it may be the dependencies you have mentioned in the question.

  • The orders are correct, jQuery has to come first for other libraries to work in sequence and in order. I have already changed the order of the libraries and the errors are still the same. Yes, they use them, but I found it strange, because in another project, with jQuery 3.2.1. and jQuery.nicescrol, nicescroll appeared normally without any error. Maybe because of jQuery or PHP dependencies?

  • Test Unitegallery on another project and it appeared normally, along with nicescroll. I think it’s because of PHP.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.