Last active
August 29, 2015 13:57
-
-
Save jmaicher/9779769 to your computer and use it in GitHub Desktop.
Example: Nested hammer.js instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<style> | |
#foo, #bar { background-color: rgba(1,1,1,.5); } | |
#foo { height: 100px; padding: 100px; } | |
#bar { height: 100px; } | |
</style> | |
</head> | |
<body> | |
<div id="foo"> | |
<div id="bar"></div> | |
</div> | |
<script src="hammer.js"></script> | |
<script> | |
var foo = document.getElementById('foo'), | |
bar = document.getElementById('bar'); | |
Hammer(foo, {}).on('dragstart drag dragend', function(evt) { | |
console.log('foo#' + evt.type); | |
}); | |
Hammer(bar, {}).on('dragstart drag dragend', function(evt) { | |
console.log('bar#' + evt.type); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment