Last active
August 29, 2018 12:02
-
-
Save adw0rd/c64268ed3d8859822922b696e4a9d32a 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
$("#address").suggestions({ | |
token: "5ef98f5781a106962077fb18109095f9f11ebac1", | |
type: "ADDRESS", | |
count: 20, | |
onSuggestionsFetch: function (suggestions) { | |
var items = []; | |
$.each(suggestions, function (i, item) { | |
if (item.value.indexOf('метро') != -1) { | |
items.splice(0, 0, item); | |
} else { | |
items.push(item); | |
} | |
}); | |
return items.slice(0, 3); // нужное кол-во подсказок | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment