Fixing the movable terminal blocking input box at the bottom of the keyboard input box lifted

Input box using the mobile terminal is fixed at the bottom of developing fixed, will lift the blocking keyboard input box

Monitor input box gets focus

$(function(){
    $ ( "# Pinglun"). Focus (function () {// get the focus input box
        var tHeight = $ (document) .height (); // get the current screen height, useless to
        console.log ( 'the current screen height =' + tHeight)
        the console.log ( 'input box receives focus')
        document.getElementById ( "dibu1"). style.position = "relative" to change the positioning // gets the focus, the id is the id you locate the input box at the
        // document.getElementById("dibu1").style.marginBottom = "cheight"+'px'
        setTimeout(function(){
            document.getElementById ( "dibu1"). scrollIntoView (true) // Delay positioned elements move, lift the keyboard takes time
        },200)
    }).blur(function(){
        the console.log ( 'input box loses focus')
        document.getElementById ( "dibu1"). style.position = "fixed" // after losing the focus back to the positioning status
    });

});

Guess you like

Origin www.cnblogs.com/lishuang2243/p/11416591.html