Home » Jquery » angular jquery touchswipe how to set up

angular jquery touchswipe how to set up

Posted by: admin February 22, 2020 Leave a comment

Questions:

I want to add a swipe event to the bootstrap carousel that I made. Here’s the link that i’m following.

https://codepen.io/andrearufo/pen/rVWpyE

    /*

dependencies:

//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js
//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js
//cdnjs.cloudflare.com/ajax/libs/jquery.touchswipe/1.6.4/jquery.touchSwipe.min.js

*/

$(".carousel").swipe({

  swipe: function(event, direction, distance, duration, fingerCount, fingerData) {

    if (direction == 'left') $(this).carousel('next');
    if (direction == 'right') $(this).carousel('prev');

  },
  allowPageScroll:"vertical"

});

I don’t know how to set up or install thesedependencies into my angular 5 project to make it works.
I suppose, first step is to include script cdns in the index.html. Then where or how do i include the javascript code in my component’s ts file ([email protected]? Do i need to import?). Since there is no step i can follow from the link alone and what I did resulted only in errors, can anyone tell me the complete steps that i need to follow when including such js files.

How to&Answer: