Jump to content
Search Community

zulfarrakk

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by zulfarrakk

  1. I found out how to solve it:

     

    data () {
          return {
            draggableItem: []
          }
        },

    methods: {
          loadList(){

            setTimeout(() => {
              //gsap.registerPlugin(Draggable, InertiaPlugin);

              this.draggableItem = Draggable.create('#wrapper__drag', {
                type:'x',
                bounds: '.drag__inner-wrapper',
                autoScroll: 1,
                inertia: true
              });

            }, 1000);
          }
        },

    mounted () {
          gsap.registerPlugin(Draggable, InertiaPlugin);

          this.$root.$on ('myEvent', () => {
            setTimeout(() => {
              this.loadList()
            }, 1500);
          });

    },
        beforeDestroy() {
          this.draggableItem[0].kill();

    }

     

    Hope this can help someone

    • Like 2
  2. Hello,

     

    I'm having an issue trying to destroy a Draggable instance on beforeDestroy and I always get the message that Draggable in not defined and so I can't kill the instance.

     

    methods: {
          loadList(){

            setTimeout(() => {
              //gsap.registerPlugin(Draggable, InertiaPlugin);

              Draggable.create('#wrapper__drag', {
                type:'x',
                bounds: '.drag__inner-wrapper',
                autoScroll: 1,
                inertia: true
              });

            }, 1000);
          }
        },

    mounted () {
          gsap.registerPlugin(Draggable, InertiaPlugin);

          this.$root.$on ('myEvent', () => {
            setTimeout(() => {
              this.loadList()
            }, 1500);
          });

    },
        beforeDestroy() {
          Draggable.get('#wrapper__drag').kill();

    }

     

    In console I get: VM15175:1 Uncaught ReferenceError: Draggable is not defined

    Please help me.

×
×
  • Create New...