Toque em Suporte em JavaScript

imagem


Quais problemas um programador de front-end pode ter se um testador iniciar seu aplicativo em um iPad com um novo teclado de trackpad, um tablet Windows, com um estado indefinido de "modo tablet" ou um laptop com uma TV com suporte multitoque conectado a ele?


, . — , , , , . . : iPad Safari, Android - Windows10 Google Chrome — .


, , , Web Touch.


Touch .


:


  • CSS :hover
  • viewport -

, .


Touch-


, . -, , .


, .
: Multi-touch. , Touch-. Touch- . , , , , .


Touch- touchstart mousemove: mousemove touchstart, , .



    touchstartHandler() {
       this._isTouch = null;
    }
    mousemoveHandler() {
       if (this._isTouch === null) {
          this.updateState(true);
       } else if (this._isTouch) {
          this.updateState(false);
       }
    }
    updateState(state) {
       this._isTouch = state;
       this._triggerEvent();
    }

, body is-touch is-hover.


:hover


:hover Touch . :hover :


   body.is-hover .my-button:hover {
   }

@media (hover: hover), hover Chrome Firefox .


:hover , .


.


imagem


, :hover- ( , ..).


:hover iOS , , . Android Windows .


Touch- :hover , swipe .


imagem


Swipe- mousemove touch- :


  • 50px;
  • 25px;
  • 600;
  • 25px , .. .


, Google Chrome .


:
1
2
:
1
2


- , . , , . . 300px , POS-.


imagem


:


imagem


, . .


imagem


, 100% :


-, API , . . .


-, . : 0.3 0.55 .


iPad Smart Keyboard, , .. .


imagem


, VisualViewport. 12 iOS, viewport .


API 2 :


  • resize, , ;
  • .

iOS12 , .. VisualViewport, .



, , . iOS . , .


-. iPad Google , , , .


, , .


, , . , , SPA- , iOS.


activate . iOS-. enableScreenKeyboard: true . .


Touch —


, Touch-. 20% , 80% : .


, Touch , .


, , , , .


, .


All Articles