Skip to content

Instantly share code, notes, and snippets.

@leoiamele
Created March 31, 2020 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoiamele/cd52b4bb7c3700496d148eaab990cdbe to your computer and use it in GitHub Desktop.
Save leoiamele/cd52b4bb7c3700496d148eaab990cdbe to your computer and use it in GitHub Desktop.
$(document).ready(function(){
console.log('LOAD AUTO')
$input = $("#search_head");
var options = {
getValue: "title",
url: function(phrase){
return "/search?q=" + phrase;
},
categories: [
{
listLocation: "items",
header: "<strong>Productos</strong>",
}],
list:{
onChooseEvent: function(){
var url = $input.getSelectedItemData().url
console.log($input)
console.log($input.getSelectedItemData())
console.log(url)
$input.val("")
window.location = url
}
}
}
$input.easyAutocomplete(options)
$input = $("#search_scroll");
var options = {
getValue: "title",
url: function(phrase){
return "/search?q=" + phrase;
},
categories: [
{
listLocation: "items",
header: "<strong>Productos</strong>",
}],
list:{
onChooseEvent: function(){
var url = $input.getSelectedItemData().url
console.log($input)
console.log($input.getSelectedItemData())
console.log(url)
$input.val("")
window.location = url
}
}
}
$input.easyAutocomplete(options)
$input = $("#sidebar");
var options = {
getValue: "title",
url: function(phrase){
return "/search?q=" + phrase;
},
categories: [
{
listLocation: "items",
header: "<strong>Productos</strong>",
}],
list:{
onChooseEvent: function(){
var url = $input.getSelectedItemData().url
console.log($input)
console.log($input.getSelectedItemData())
console.log(url)
$input.val("")
}
}
}
$input.easyAutocomplete(options)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment