zulfarrakk
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by zulfarrakk
-
-
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.
Vue - Draggable Instance cannot be killed
in GSAP
Posted
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