IOS WeChatブラウザのキーボード押出ページを弾き返さない解決方法


import { Directive, ElementRef } from '@angular/core';


@Directive({
  selector: '[appResetPage]'
})
export class ResetPageDirective {

  constructor(el: ElementRef) {

    //                ,input     ,  
    //        

    /*
     * iOS12    ,                        
     *     ,             ,            
     *     :
     *               1px             
     */
    document.body.addEventListener('focusout', () => {
      //           
      const ua = window.navigator.userAgent;
      const app = window.navigator.appVersion;
      // $alert('     : ' + app + '
' + ' : ' + ua); if (!!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) { // $alert('ios '); let currentPosition, timer; let speed = 1; timer = setInterval(function () { currentPosition = document.documentElement.scrollTop || document.body.scrollTop; currentPosition -= speed; window.scrollTo(0, currentPosition); // currentPosition += speed; window.scrollTo(0, currentPosition); // clearInterval(timer); }, 100); } else if (ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1) { // alert('android '); } }); } }