Skip to content

Can't seem to drag divider on mobile #4

Description

@aaemnnosttv

I'm having trouble getting the divider to move on mobile using the jquery build.

I thought this might have something to do with the bindings missing for the touch events, so I tried adding these (in the equivalent place in the dist file):

diff --git a/src/js/jquery.twentytwenty.js b/src/js/jquery.twentytwenty.js
index d481877..c7bb2d5 100644
--- a/src/js/jquery.twentytwenty.js
+++ b/src/js/jquery.twentytwenty.js
@@ -61,17 +61,17 @@ var TT = require('./core.js');
       };

       container
-        .on('mousedown', function(e) {
+        .on('mousedown touchstart', function(e) {
           isActive = true;
           container.addClass('active');
           adjustContainerOnSwipe(e);
         })
-        .on('mousemove', function(e) {
+        .on('mousemove touchmove', function(e) {
           if (isActive) {
             adjustContainerOnSwipe(e);
           }
         })
-        .on('mouseup', function(e) {
+        .on('mouseup touchend', function(e) {
           adjustContainerOnSwipe(e);
           container.removeClass('active');
           isActive = false;

However that didn't seem to change anything.

The divider can be moved by just tapping on the location you want it to jump to, but that kind of kills the effect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions