有人可以帮我将以下代码转换为普通的js
$(function() {
var wheight = $(window).height(); //get height of the window
$('.fullheight').css('height', wheight);
$(window).resize(function() {
var wheight = $(window).height();
$('.fullheight').css('height', wheight);
});
});
答案 0 :(得分:2)
document.addEventListener( "DOMContentLoaded", func, false )
window.addEventListener( "resize", func, false);
function func() {
var wheight = window.outerHeight;
var elems = document.querySelectorAll('.fullheight');
for (var i=elems.length; i--;) {
elems[i].style.height = wheight + 'px';
}
}