Я хочу изменить видимость элемента после прокрутки пользователя вниз на 100 пикселей.
У меня уже есть код,
var fixed = false;
$(document).scroll(function() {
if( $(this).scrollTop() >= 100 ) {
if( !fixed ) {
fixed = true;
$('#logo-scroll').css({position:'fixed', display:'visible !important'});
}
} else {
if( fixed ) {
fixed = false;
$('#logo-scroll').css({display:'none'});
}
}
});
Код имеет две проблемы.
-
Он не является невидимым по умолчанию, я хочу, чтобы он стал невидимым.
-
Он не повторяется, когда пользователь прокручивает резервную копию, он не становится невидимым.
Подробнее,
Я хочу сделать что-то вроде этого заголовка, но, как вы видите, есть определенный момент, когда вы видите половину маленького логотипа и ЧАСТЬ тем больше. Это не влияет на techcrunch, так как заголовок небольшой, но на моем сайте он делает это. Я сделал все, мне просто нужно запустить его в display:none
и стать видимым после 100px.