YUI3 - Autocomplete with local images -
i'm trying make input auto-completion since 'm working emoticons need show picture , text on list of recommendations
<div id="demo" class="yui3-skin-sam"> <input id="ac-input" type="text"> </div> yui().use('autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', function (y) { y.one('#ac-input').plug(y.plugin.autocomplete, { resultfilters : 'phrasematch', resulthighlighter: 'phrasematch', source : ['alabama','alaska','arizona'] }); });
the output should like
thanks !!!
here great example right yui3 documentation: http://yuilibrary.com/yui/docs/autocomplete/ac-flickr.html?mock=true
the important part of code result formatter:
resultformatter: function (query, results) { return y.array.map(results, function (result) { return '<div class="result">' + '<img class="photo" src="' + getimageurl(result) + '" alt="thumbnail">' + '<span class="title">' + result.highlighted + '</span>' + '</div>'; }); }
Comments
Post a Comment