Last active
August 29, 2015 13:57
-
-
Save d-adamkiewicz/9832786 to your computer and use it in GitHub Desktop.
YUI3 event handling simple example
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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>YUI Event example</title> | |
<script src="http://yui.yahooapis.com/3.15.0/build/yui/yui-min.js"></script> | |
<style typr="text/css"> | |
#clickable { | |
cursor: pointer; | |
background: #cdcdcd; | |
width: 5em; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="clickable">Click me</div> | |
<script> | |
YUI().use('event', function(Y) { | |
var clickable = Y.one('#clickable'); | |
var Clickable = function(ev) { | |
var result = clickable.detach('click'); | |
console.log(new Date().toString() + ' clicked!: ' + result); | |
clickable.on('dblclick', DblClickable); | |
}, | |
DblClickable = function(ev) { | |
console.log('dblclicked: ' + clickable); | |
}; | |
clickable.on('click', Clickable); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment