Skip to content

Commit

Permalink
First click wasn't taken into account.
Browse files Browse the repository at this point in the history
 - since onChange is triggered when the field lose the focus, another
   query was performed replacing the current results with new ones;
   avoiding the icon element to receive the click event
 - store the query in the DOM avoiding results to be replaced if the query
   didn't changed
Fix#3
  • Loading branch information
redox committed Nov 16, 2013
1 parent 44766c3 commit d134cad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ var index = new AlgoliaSearch("9JQV0RIHU0", "2219d421236cba4cf37a98e7f97b3ec5").
$filters = $("#filter a");

function search(v) {
if ($('#search').data('q') == v) {
// do not perform the same query twice, results will not change
return;
}
$('#search').data('q', v);

index.search(v, function(success, content) {
if (!success) {
return;
Expand Down

0 comments on commit d134cad

Please sign in to comment.