Tuesday, May 26, 2015

Slip.js

I've been playing around with making mobile apps using Cordova.  Being pretty new to this, my biggest challenges have revolved around implementing touch interactions.  For example, how could I swipe an element on a page and make it disappear, kind of like in Android notifications?

I found one little JS script that does (and more!).  
https://github.com/pornel/slip

Demo: https://pornel.net/slip/

Just make a list in your html, then paste this into your JS:

  var list = document.getElementById('yourListId');
        new Slip(list);
        list.addEventListener('slip:swipe', function(e) {
            e.target.parentNode.removeChild(e.target);
        });

Nice!

Also, I found this article to be helpful if you need more resources on drag-and-drop type stuff:
http://mobiforge.com/design-development/touch-friendly-drag-and-drop