I need to find a way to change css when an element is not on its default position anymore,and when the user scrolls it back , the default css is set back.
Example: I have a fixed header with a height of 30px , and the position of it is top: 0 , when the user scoll down , the height will be 15px , and if the user scroll up and the header gets its initial position of top: 0 , the height will be 30px again.
I tried something like this:
var location = $('#header').offset();
$( "#header" ).scroll(function() {
if(location.top!=0){
$('#header').css({'height': '4vw'});
}else{
$('#header').css({'height': '6vw'});
}
});