drewjbartlett / vue-flickity

A Vue Slider / Carousel Component for Flickity.js
http://drewjbartlett.com/demos/vue-flickity/
374 stars 55 forks source link

Add drag binding #23

Closed danielpost closed 6 years ago

danielpost commented 7 years ago

Would it be possible to add these functions?

https://codepen.io/desandro/pen/adYJEQ/

drewjbartlett commented 6 years ago

@danielpost Sorry, but which methods exactly?

jkniest commented 6 years ago

I guess he is talking about the javascript part to toggle draggable

drewjbartlett commented 6 years ago

@danielpost @jkniest ah alright. Well I won't have a ton of time soon but I just updated the component last week and it's a lot easier to add new methods. So please feel free to make a PR if you'd like - otherwise it may be a bit :)

alexmccabe commented 6 years ago

@drewjbartlett Flickity recently updated to version 2.1.1, and with it came an update to the way enabling and disabling of drag works.

Previously instance.unbindDrag() and instance.bindDrag() were the methods for enabling and disabling dragging. This was accessible through your component by this.$refs.flickity.flickity.unbindDrag() and this.$refs.flickity.flickity.bindDrag(). This was a valid workaround, which has since stopped functioning.

The current method for toggling the ability to drag is first setting the draggable option instance.options.draggable = true|false, and then calling the updateDraggable method instance.updateDraggable();. This method is not available on your version of the plugin, either through your API or through the instance provided.

alexmccabe commented 6 years ago

I have just created a pull request that resolves this issue. I've added two new methods (enableDrag() and disableDrag()), and updated Flickity to the latest version.