I have created a fork of this cool swipe drawer navigation: https://codepen.io/carl-victor-fontanos/pen/NQPLGW which works perfectly when swiping from Left to Right.
I am currently attempting to enable swiping from Right to Left, but I was only able to get it partially working. Here is what I've got so far: https://codepen.io/carl-victor-fontanos/pen/gVbdYq -- in this pen you will notice that it now opens from Right to Left, but the problem is that the swipe is still in reverse which is not what I want. I have modified the CSS to get the position to appear in right instead of left, and in the Javascript side I have changed translateX
from negative to positive value.
Hopefully someone can help me get this working, as I have been trying to solve this for hours.
The actual simple fix for the swipe direction is to set x = -x in the "move" function
function move(x, e) {
x = -x;
We could have a cleaner solution but this works. Then I think you need to change the intent calculation because with just the x =-x change you need to swipe slowly until the edge to actually close the panel. Hope this helps
(I just realised I just checked the closing not the opening).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With