I removed the variable names and just put the values in for simplicities sake.
Can't work out why this doesn't work properly, the else statement works fine, the if statement works fine but the else if part doesn't.
if (scrollTop > 200) {
$('.vote-next-hover').css({
position: 'fixed',
top: '50px',
width: statuscontain,
});
}
else if (scrollTop > 5500) {
$('.vote-next-hover').css({
position: 'absolute',
top: '',
width: '',
});
}
else {
$('.vote-next-hover').css({
position: 'relative',
top: '',
width: '',
});
}
Scroll 200px, fires the if statement, scroll back to less than 200 and it fires the else statement, but at no point does it fire the else if statement.
I thought it would sort of be - Condition 1 met, fires - Condition 2 met, fires - Condition 3 met, fires?
top: '0px'or something?elsemeans that the previous condition is not met. IfscrollTop > 5500chances are it is also ` > 200`