Answer the question
In order to leave comments, you need to log in
How to make elements appear and disappear when scrolling jquery?
jQuery(function(f){
var element = f('#logocenter');
f(window).scroll(function(){
element['fade'+ (f(this).scrollTop() < 100 ? 'In': 'Out')](300);
});
});
jQuery(function(d){
var element = d('#logocenter');
d(window).scroll(function(){
element['fade'+ (d(this).scrollTop() > 100 ? 'Out': 'In')](300);
});
});
jQuery(function(a){
var element = a('#nav');
a(window).scroll(function(){
element['fade'+ (a(this).scrollTop() > 100 ? 'Out': 'In')](500);
});
});
Answer the question
In order to leave comments, you need to log in
Now there is one question left: how can I combine these two functions into one, otherwise it blinks twice)))
jQuery(function(d){
var element = d('#logocenter');
d(window).scroll(function(){
element['fade'+ (d(this).scrollTop() > 100 ? 'Out': 'In')](300);
});
});
$(window).scroll( () => {
let windowTop = $(window).scrollTop();
windowTop > 100 ? $('#logocenter').fadeIn(300) : $('#logocenter').fadeOut (300);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question