window.onload = function(){
var xx = document.documentElement.clientHeight;
// 470为要垂直居中的div的高度
he = (xx-470)/2;
console.log(he);
document.getElementsByClassName('weixin_public')[0].style.marginTop = he + 'px'; }
通过以上的js控制即可达到垂直居中的效果
window.onload = function(){
var xx = document.documentElement.clientHeight;
// 470为要垂直居中的div的高度
he = (xx-470)/2;
console.log(he);
document.getElementsByClassName('weixin_public')[0].style.marginTop = he + 'px'; }
通过以上的js控制即可达到垂直居中的效果