Created
February 16, 2015 15:18
-
-
Save mokus80/3bfdba82a86432e8115a 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
$(document).ready(function() { | |
// Replace the following values by your ApplicationID and ApiKey. | |
var algolia = new AlgoliaSearch('S28V4HJTQ8', '3aef8f24cf93555ef37e43432a6b41a8'); | |
// set environment | |
var env = $("html").data("env") | |
// replace YourIndexName by the name of the index you want to query. | |
var index = algolia.initIndex("locations" + "_" + env); | |
// typeahead.js initialization | |
$('#user-search').typeahead({ hint: false }, { | |
source: index.ttAdapter({ hitsPerPage: 10 }), | |
displayKey: 'searchable', | |
templates: { | |
suggestion: function(hit) { | |
// render the hit | |
return hit.searchable; | |
} | |
} | |
}); | |
}); | |
.twitter-typeahead { width: 100%; } | |
.twitter-typeahead .tt-input, .twitter-typeahead .tt-hint { width: 100%; margin: 0px; padding: 8px 12px; border: 2px solid #ccc; outline: none; } | |
.twitter-typeahead .tt-input:focus { border: 2px solid #0097cf; } | |
.twitter-typeahead .tt-hint { color: #999; } | |
.twitter-typeahead .tt-dropdown-menu { width: 100%; padding: 0; background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.2); border-top: 0px; } | |
.twitter-typeahead .tt-dropdown-menu .tt-suggestion { text-align: left; padding: 3px 20px; font-size: 18px; line-height: 24px; } | |
.twitter-typeahead .tt-dropdown-menu .tt-suggestion.tt-cursor { color: #fff; background-color: #0097cf; } | |
.twitter-typeahead .tt-dropdown-menu .tt-suggestion em { font-weight: bold; font-style: normal; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment