防止点击input输入框时,页面被键盘顶开

2018-10-26  本文已影响56人  天字一等

html:

<input type="number" style="position: absolute;height: 100%;" value="et we" onclick="sr(this);" onblur="nosr(this);" />

js:

var timer1;
            function sr(obj) {
                timer1 = setInterval(function() {
                    obj.scrollIntoView(false);
                }, 0);
            }
            function nosr(obj) {
                clearInterval(timer1);
            }
上一篇下一篇

猜你喜欢

热点阅读