文本框点击和焦点时改变scrollTop值
/*文本框点击和焦点时改变scrollTop值*/ function inputChangeScrollTop(obj, topNum, scrollObj) { if (deviceInfo.isAndroid()) { var $obj = obj, topnum = 100; if (topNum != undefined) { topnum = topNum; } if (scrollObj == undefined) { scrollObj = $('.content'); } $obj.on('click', function (e) { setScrollTop($(this)); }); function setScrollTop(_this) { var $this = _this, setTimer = setTimeout(function () { var $this = _this, top = $this.offset().top, scrollHeight = scrollObj.scrollTop() + top - topnum; scrollObj.animate({ scrollTop: scrollHeight },200); clearInterval(setTimer); }, 500); } } };