我需要在 window.resize() 上更改一些变量值。
我已经发现您需要在 .resize 函数范围之外声明变量,然后我尝试在函数 .resize 范围内更改它们的值。但这似乎不起作用。
var windowHeight = $(window).height();
var goPanel0, goPanel1, goPanel2, goPanel3;
goPanel0 = 0;
goPanel1 = windowHeight;
goPanel2 = windowHeight * 2;
goPanel3 = windowHeight * 3;
$(window).resize(function(){
goPanel1 = windowHeight;
goPanel2 = windowHeight * 2;
goPanel3 = windowHeight * 3;
//alert(goPanel3);
});
谢谢,