$('.class or #id').click(function() {
$( 'html, body' ).animate( { scrollTop : 0 }, 200 );
return false;
});
$(window).scroll(function(){
const windowTop = $(window).scrollTop();
if(windowTop == 0){
$('.class or #id').fadeOut(200);
} else if(windowTop > 0){
$('.class or #id').fadeIn(200);
}
})
let beforScroll = 0;
$(window).on('scroll', function(){
let afterScroll = $(this).scrollTop();
if($(window).innerWidth() > 991) {
if(beforScroll < afterScroll){
gsap.to('.header', {duration:0.2, opacity:0, onComplete:function(){$('.header').hide()}})
} else {
$('.header').show();
gsap.to('.header', {duration:0.2, opacity:1})
}
} else {
if(beforScroll < afterScroll){
gsap.to('.m-header', {duration:0.2, opacity:0, onComplete:function(){$('.m-header').hide()}})
} else {
$('.m-header').show();
gsap.to('.m-header', {duration:0.2, opacity:1})
}
}
beforScroll = afterScroll;
})