Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add touch/swipe support #8

Open
felixhagspiel opened this issue Mar 9, 2015 · 2 comments
Open

Add touch/swipe support #8

felixhagspiel opened this issue Mar 9, 2015 · 2 comments
Assignees

Comments

@felixhagspiel
Copy link
Owner

No description provided.

@milanffm
Copy link

milanffm commented Dec 1, 2015

hi added hammerjs for toch/swipe support:

(function() {

    var Lightbox = require('./plugins/lightbox');
    var LIGHTBOX_OPEN_BOX = '#jslghtbx';

    var Hammer = require('hammerjs');

    var _lightbox = new Lightbox();
    var _hammertime;

    _lightbox.load({

        onopen:function(){
            var _box = document.querySelector(LIGHTBOX_OPEN_BOX);
            _hammertime = new Hammer(_box);

            _hammertime.on('panend', function(e) {

                switch (e.direction) {
                    case 2:
                        _lightbox.next();
                        break;
                    case 4:
                        _lightbox.prev();
                        break;
                }
            });

        },

        onclose:function(){

            _hammertime.off('panend');
        }
    });





})();

@felixhagspiel
Copy link
Owner Author

hey @milanffm thanks for the suggestion! I want to leave 3rd party code out of the lightbox to keep it clean and small, but I will definetly look into hammerjs

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

No branches or pull requests

2 participants