Skip to content

Instantly share code, notes, and snippets.

@taivo
Last active October 29, 2016 18:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taivo/ec78e20e9e3efb15fab4 to your computer and use it in GitHub Desktop.
Save taivo/ec78e20e9e3efb15fab4 to your computer and use it in GitHub Desktop.
Remove 300ms delay from google maps autocomplete in ionic framework. Inspired by http://davidwalsh.name/detect-node-insertion . Tested on: Nexus 5 Android, Nexus 7 tablet, and iPhone 6 Safari
//
// CSS - define a keyframe animation called 'nodeInserted'
//
@keyframes nodeInserted {
from { opacity: 0.99; }
to { opacity: 1; }
}
@-webkit-keyframes nodeInserted{
from { opacity: 0.99; }
to { opacity: 1; }
}
div.pac-container {
animation-duration: 0.001s;
animation-name: nodeInserted;
-webkit-animation-duration: 0.001s;
-webkit-animation-name: nodeInserted;
}
//
// Jquery - listen for 'nodeInserted'
// note the 'one' event registration to avoid repeating the same task
//
$(document).one('animationstart webkitAnimationStart MSAnimationStart', 'div.pac-container', function(event){
if(event.originalEvent.animationName === 'nodeInserted'){
$(event.target).attr('data-tap-disabled', true).click(function(){
$('#myAutocompleteInputElem').blur(); //closes the selection drop down
});
}
});
@tamerbak
Copy link

Do you have a solution for ionic V2 ? thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment