azerion / phaser-input

Adds input boxes to Phaser like CanvasInput, but also works for WebGL and Mobile, made for Phaser only.
MIT License
203 stars 64 forks source link

StartFocus causing scroll #19

Closed EddieOne closed 7 years ago

EddieOne commented 7 years ago

I changed

this.element.style.top = (-100).toString() + 'px';

to

this.element.style.width = 0;
this.element.style.height = 0;
this.element.style.top = (100).toString() + 'px';

and it seemed to fix them problem of scrolling to the top of a page when an input gains focus.

AleBles commented 7 years ago

You'll still be able to scroll up, but it depends on how far down your game is on the page. I haven't tought about setting the width/height to zero but I will test it to see if it'll still work on all device.

EddieOne commented 7 years ago

I found it worked more as I expected hiding the input off to the left rather than above the game. Since I use iframes to display the game, the absolute is not relative to the page hosting the game. There is still some scrolling, but at least it scroll to the game rather than above it.