jQuery滚动到iOS地址栏顶部

问题描述:

jQuery的.animate({ scrollTop: '0' }, 600 });将iOS滚动到页面的顶部,但不滚动到绝对顶部(显示地址栏)。有什么办法可以把它呢?jQuery滚动到iOS地址栏顶部

谢谢!

// Will scroll to the top and will show the address bar 
$('body').scrollTop(); 

// Will scroll to the top and won't show the address bar 
$('body').animate({ scrollTop: '0' }, 0) 

$('body').scrollTop(0);将页面滚动位置设置为页面的顶部,而$('body').scrollTop();将返回当前滚动位置。