-
-
Save JackNova/7865204 to your computer and use it in GitHub Desktop.
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> | |
<title> | |
</title> | |
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"> | |
</script> | |
<link rel="stylesheet" type="text/css" href="css/combo.css"> | |
</head> | |
<body class="yui3-skin-sam"> | |
<div class="combo"> | |
<input type="text"> | |
</input> | |
<button> | |
... | |
</button> | |
</div> | |
</body> | |
<script> | |
// Create a new YUI instance and populate it with the required modules. | |
YUI({ | |
filter: 'RAW' | |
}).use(['autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', 'event-outside'], function(Y) { | |
var ac = new Y.AutoCompleteList({ | |
inputNode: '.combo input', | |
source: ['friends', 'Romans', 'countrymen', 'bla', 'blub', 'blablub'], | |
render: true, | |
minQueryLength: 0, | |
tabSelect: true, | |
activateFirstItem: true | |
}); | |
Y.one('.combo button').on('click', function(e) { | |
console.log(ac); | |
e.stopPropagation(); | |
if (ac.get('visible')) { | |
ac.hide(); | |
} else { | |
ac.sendRequest(); | |
ac.show(); | |
} | |
}); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment