(function(window) {
	"use strict";

	var dom     = window.dom;
	var on      = dom.events.on;
	var trigger = dom.events.trigger;
	var closest = dom.closest;
	var tau     = Math.PI * 2;

	var elasticDistance = 800;

	var rspaces = /\s+/;

	function elasticEase(n) {
		return Math.atan(n) / Math.PI ;
	}

	function xMinFromChildren(node) {
		var last = dom(node.children)
			.filter(dom.matches('.switchable'))
			.last()
			.shift();
		
		// Get the right-most x of the last switchable child's right-most edge
		var w1 = last.offsetLeft + last.clientWidth;
		var w2 = node.parentNode.clientWidth;
		return w2 - w1;
	}

	on(document, 'touch', function(e) {
		if (e.defaultPrevented) { return; }

		var node = closest('.slideable', e.target);
		if (!node) { return; }

		var classes = dom.classes(node);
		var transform = dom.style('transform', node);

		transform = !transform || transform === 'none' ? '' : transform ;

		var x = dom.style('transform:translateX', node);
console.log(x);
		// Elastic flags and limits
		var eMin = false;
		var eMax = false;
		var xMin = dom.attribute('data-slide-min', node);
		var xMax = dom.attribute('data-slide-max', node);

		if (!xMin && !xMax) {
			eMin = true;
			eMax = true;
			xMin = xMinFromChildren(node);
			xMax = 0;
		}
		else {
			eMin = /elastic/.test(xMin);
			eMax = /elastic/.test(xMax);
			xMin = parseFloat(xMin) || 0;
			xMax = parseFloat(xMax) || 0;
		}

		classes.add('notransition');

		var ax = x;

		// e.detail() is a stream of touch coordinates
		e.detail()
		.map(function(data) {
			ax = x + data.x;
			var tx = ax > 0 ?
					eMax ? elasticEase(ax / elasticDistance) * elasticDistance - x :
					xMax :
				ax < xMin ?
					eMin ? elasticEase((ax - xMin) / elasticDistance) * elasticDistance + xMin - x :
					xMin :
				data.x ;

			return transform + ' translate(' + tx + 'px, 0px)';
		})
		.each(function(transform) {
			node.style.transform = transform;
		})
		.on('done', function() {
			classes.remove('notransition');

			// Todo: Watch out, this may interfere with slides
			var xSnaps = dom.attribute('data-slide-snap', node);
console.log(xSnaps)
			if (!xSnaps) { return; }
			xSnaps = xSnaps.split(rspaces).map(parseFloat);
console.log(xSnaps)
			// Get closest x from list of snaps
			var tx = xSnaps.reduce(function(prev, curr) {
				return Math.abs(curr - ax) < Math.abs(prev - ax) ?
					curr : prev ;
			});
console.log(tx);

			//requestAnimationFrame(function() {
				node.style.transform = transform + ' translate(' + tx + 'px, 0px)';
			//});
		});
	});

	on(document, 'swipe', function(e) {
		if (e.defaultPrevented) { return; }

		var node = closest('.slideable', e.target);
		if (!node) { return; }

		var angle    = Fn.wrap(0, tau, e.angle || 0);
		var velocity = e.velocity || 0;

			// If angle is rightwards
		var prop = (angle > tau * 1/8 && angle < tau * 3/8) ?
				'previousElementSibling' :
			// If angle is leftwards
			(angle > tau * 5/8 && angle < tau * 7/8) ?
				'nextElementSibling' :
				false ;

		if (!prop) { return; }

		var active = dom(node.children)
		.filter(dom.matches('.active'))
		.shift();

		if (active[prop]) {
			trigger(active[prop], 'dom-activate');
		}
		else {
			var l1 = dom.viewportLeft(node);
			var l2 = dom.viewportLeft(active);

			// Round the translation - without rounding images and text become
			// slightly fuzzy as they are antialiased.
			var l  = Math.round(l1 - l2 - dom.style('margin-left', active));
			node.style.transform = 'translate(' + l + 'px, 0px)';
		}
	});

	on(document, 'dom-activate', function(e) {
		// Use method detection - e.defaultPrevented is not set in time for
		// subsequent listeners on the same node
		if (!e.default) { return; }

		var node   = e.target;
		var parent = node.parentNode;

		if (!dom.matches('.slideable', parent)) { return; }

		var classes = dom.classes(parent);
		classes.remove('notransition');

		var w = document.documentElement.clientWidth;
		var l1 = dom.viewportLeft(node);
		var l2 = dom.viewportLeft(parent);
		var l  = l1 - l2 - dom.style('margin-left', node);

		parent.style.transform = 'translate(' + (-l) + 'px, 0px)';
		e.preventDefault();
	});
})(this);

@@ -966,23 +966,8 @@
 e);%0A
-console.log(x);
 %0A%09%09/
@@ -2078,35 +2078,16 @@
  node);%0A
-console.log(xSnaps)
 %0A%09%09%09if (
@@ -2162,27 +2162,8 @@
 t);%0A
-console.log(xSnaps)
 %0A%09%09%09
@@ -2331,25 +2331,8 @@
 %09%7D);
-%0Aconsole.log(tx);
 %0A%0A%09%09

Remove logs