Library events
Kreshnik opened this issue · 2 comments
Kreshnik commented
Hi there,
It would be very helpful if the library had custom events. Events such as leftImageRevealed, rightImageRevealed and other dragging related events.
Kind regards,
Kreshnik
koenoe commented
Good idea! I'll definitely take a look at it.
@Kreshnik what would you expect as value? A percentage?
Kreshnik commented
@koenoe, the percentage would be great.
For both left/right, like how many percentages the left image is revealed, and how many the right.
Would seem quite helpful.
I myself had this particular use case, I solved it by adding the below code into the drag()
method. Right after the openRatio
is calculated.
this.orientationPercentage = {
left: Math.abs(Math.abs(openRatio * 100)),
right: Math.abs(100 - (openRatio * 100))
};