Created
September 30, 2013 10:07
-
-
Save olimortimer/6761771 to your computer and use it in GitHub Desktop.
JS: Bootstrap Typeahead FastClick 'needsclick'
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
// Add our 'needsclick' to our a href for each item, so FastClick doesn't get applied | |
$('#typehead').data('typeahead').render = function (items) { | |
// We basically do what the normal typeahead function does... | |
var that = this; | |
items = $(items).map(function (i, item) { | |
i = $(that.options.item).attr('data-value', item); | |
// ...but we add 'needsclick' to the a href | |
i.find('a').addClass('needsclick').html(that.highlighter(item)); | |
return i[0]; | |
}) | |
this.$menu.html(items); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment