It's kinda hard to explain for me, but I'll give an example.
Let's take this function:
$(window).resize(()=>{
if(window.innerHeight < 500){
$wrapper.height('100vh')
}
else{
$wrapper.height('60vh')
}
})
Of course this code doesn't execute without resizing the window, so I have to write it again outside the resize function, so it works all the time, just like that:
if(window.innerHeight < 500){
$wrapper.height('100vh')
}
else{
$wrapper.height('60vh')
}
Is there a way not to repeat the code like in the example above? Is there a function for this?