2
I want to hide the image when the scroll
page is larger than 147, so far so good, the problem is that I can not hide the image again when the scroll
is less than 146. The goal is to hide and show the image according to the scroll.
Below I left an example:
$(document).ready( () => {
var logo = $("#img-logo-fixed");
$(document).scroll( function() {
var scroll = $(document).scrollTop();
if(scroll >= 147) $("#img-logo-fixed").css("display", "block");
if(scroll < 146 ) $("img-logo-fixed").css("display", "none");
});
});
#img-logo-fixed {
position:fixed;
top:0;
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="http://lucianodev.com/gameutil2d/site/imagens/icone-android.png" id="img-logo-fixed" >
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
Can someone help me?
Damn, what a lack of attention. I’ve been on a project for 10 hours, tiredness has taken hold of me. Thank you!!!
– Jorge.M
@Jorgematheus you need more rss coffee! Good luck there that good that solved!
– hugocsl