I need to have some variable values change on window.resize().
I already found that you need to declare the variables outside the .resize function scope, i then try
simply you are not getting the new window height after resizing, so it will give you the same old value over and over, you have to re-assign the value (get the value) from inside the event's function to get the new one and use it.
$(window).resize(function(){
windowHeight = $(window).height(); // get new height after change
goPanel1 = windowHeight;
goPanel2 = windowHeight * 2;
goPanel3 = windowHeight * 3;
});
$(window).resize(function(){
windowHeight = $(window).height(); // add this line
goPanel1 = windowHeight;
goPanel2 = windowHeight * 2;
goPanel3 = windowHeight * 3;
//alert(goPanel3);
});
value to variable windowHeight was assigned out of .resize scope, and in .resize has previous value, but should have new value