function scrollTo(dom, dis, dir = "up") {
    if(dir == "up") { 
        var scroll = function() {
            var timer = setTimeout( function() {
                if(dom.scrollTop() > dis) {
                    dom.scrollTop(dom.scrollTop() -50);
                    // alert(dom.scrollTop());
                    scroll();
                } else { 
                    dom.scrollTop(dis);
                    clearTimeout(timer); 
                    timer = null; 
                } 
            }, 10);
        }
        scroll();
    }
}call this function to perform scrolling. When you scroll to the top, input will focus automatically. What if you don"t want him to focus automatically?
