i want to change CSS or menu bar while scrolling and restore old CSS when scroll stops using if else. this is what i did so far.
if ($(window).scroll(function () {
$('#nav').css('opacity', '0.85');
} else {
$('#nav').css('opacity', '1');
});
working code without if statement
$(document).scroll(function() {
$('#nav').css('opacity', '0.85');
});
if ($(window).scrollis... very strange. What really do want to check inif?$(window).scroll()binds a handler to the scroll event. It doesn't return anything that you can test withif.