0

In my slide show project, user can swipe left or right to change to pervious or next image.

<script src="/Style/js/jquery-1.10.2.js"></script>
<script src="/Style/jquery.mobile/jquery.mobile.min.js"></script>
 <script>
 $(document).ready(function () {
    $(slideWebpartId + " .carousel").swiperight(function (e) {
        $(this).carousel('prev');
    });
    $(slideWebpartId + " .carousel").swipeleft(function (e) {
        $(this).carousel('next');
    });
    $(slideWebpartId + ' .carousel').carousel();
});
</script>

However, when other userControl is calling jQuery library, the following error message will be shown:

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

Sample code for the question:

 <script src="/Style/js/jquery-1.10.2.js"></script>
    <script src="/Style/jquery.mobile/jquery.mobile.min.js"></script>
     <script>
     $(document).ready(function () {
        $(slideWebpartId + " .carousel").swiperight(function (e) {
            $(this).carousel('prev');
        });
        $(slideWebpartId + " .carousel").swipeleft(function (e) {
            $(this).carousel('next');
        });
        $(slideWebpartId + ' .carousel').carousel();
    });
    </script>
      //.............
     // my user control------------
     <script src="/Style/js/jquery-1.10.2.js"></script>
Hasan Elsherbiny
  • 598
  • 2
  • 14
  • 31
MRWonderFuXker
  • 203
  • 3
  • 19
  • possible duplicate of [How to make Bootstrap carousel slider use mobile left/right swipe](http://stackoverflow.com/questions/21349984/how-to-make-bootstrap-carousel-slider-use-mobile-left-right-swipe) – deblocker May 09 '17 at 08:50
  • @deblocker my slide show can be swiped perfectly in code set one. However, the code set two shows how other user control affect my slide show – MRWonderFuXker May 09 '17 at 08:58
  • nothing previously set with an instance of jQuery will automagically work with a second instance – deblocker May 09 '17 at 09:14

0 Answers0