Answer the question
In order to leave comments, you need to log in
Show item on scroll?
Hello everyone, here is the code when scrolling, an object appears, but I can’t figure out how to make it appear in a certain place , and disappear if you scroll back, what can you tell?
$(document).ready(function(){
$(window).scroll(function(){
var scroll = $(this).scrollTop();
if (scroll > $('.fix').offset().top-($(window).height()/2)){
$(".fix").css({
console.log(scroll);
'transition' : 'all 1s ease',
'opacity' : '1'});
}
});
});
Answer the question
In order to leave comments, you need to log in
I remembered myself at the beginning of the journey).
You already have one if.
You need another one to check
if ( true === 'листаешь обратно' ) {
// opacity = 0
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question