My goal is for the #sequence div to be full height of the browser window when the window size is greater than 920px in height. In such cases, I also want to trigger a plugin. If the window size is lower than 920px, then the height of the #sequence div should default to the value set in my CSS file. This functionality works when the page is initially loaded, but I am facing issues with the resize event not being triggered. Despite no errors in the console, the resize event remains unresponsive.
Below is the code snippet that I have used, which is largely based on a post found on Stack Overflow:
var eventFired = 0;
if ($(window).height() < 920) {
} else {
fitSequence();
eventFired = 1;
}
$(window).on('resize', function() {
if (!eventFired == 1) {
if ($(window).height() < 920) {
} else {
$(window).resize(function(){ fitSequence(); });
}
}
});
For reference, this is the fitSequence plugin that I am using:
function fitSequence(){
var height=$(window).height();
$('#sequence').css('height',height-100+"px");
};