workaround more missing click events

This commit is contained in:
Sam 2015-03-25 14:11:17 +11:00
parent 64cf14e19e
commit eec87b5513
1 changed files with 15 additions and 5 deletions

View File

@ -34,7 +34,7 @@ function positioningWorkaround($fixedElement) {
return;
}
fixedElement.style.top = window.scrollY + iPadOffset + 'px';
}, 500);
}, 400);
if (fixedElement.style.position !== 'absolute') {
@ -68,12 +68,22 @@ function positioningWorkaround($fixedElement) {
self.addEventListener('blur', blurred);
};
function attachTouchStart(elem, fn) {
if (!$(elem).data('listening')) {
elem.addEventListener('touchstart', fn);
$(elem).data('listening', true);
}
}
const checkForInputs = _.debounce(function(){
$fixedElement.find('button,a').each(function(){
attachTouchStart(this, function(evt){
evt.preventDefault();
$(this).click();
});
});
$fixedElement.find('input,textarea').each(function(){
if (!$(this).data('listening')) {
this.addEventListener('touchstart', positioningHack);
$(this).data('listening', true);
}
attachTouchStart(this, positioningHack);
});
}, 100);