I am a newcomer to JS programming and I am eager to create my own script for more practice. However, I could use some assistance. To begin with, I have a basic array set up at the start of my script:
Var
viewportHeight = $(window).height();
contentTop = [0, viewportHeight, viewportHeight*2, viewportHeight*3, viewportHeight*4];
Then, in the middle of the code, I require a function that will trigger on window resize and update the array with new values.
$(window).resize(function() {
for (i = 0; i < contentTop.length; i++) {
contentTop[i] = {
viewportHeight * i
};
}
});
Similar procedures seem to work in other programming languages, but not in JS, at least in my case. Is there an alternative approach to accomplishing this?
Thank you in advance,
Alex