换了其它的方式实现,通过window.screen.height可以获取屏幕的高度,而不受那个当行bar的影响。
document.cilentHeight 则是受bar的影响的
function get_view_port_width() { return window.screen.width; } function get_view_port_height() { return window.screen.height; }
另外IOS与安卓不一样所以要做一个判断:
if(window.orientation ==