I have a div that is appearing on scroll after 520px. Every time I scroll down, it appears to fade in and then constantly flickers, like it keeps running the function over and over again. I've googled this endlessly and I can't find a fix that actually works. (It's on Chrome). Here's my Jquery:
$(window).bind("scroll", function(e) {
e.preventDefault();
if ($(this).stop().scrollTop() > 520) {
$("#fadeblock").fadeIn();
} else {
$("#fadeblock").stop().fadeOut();
}
});
And this is my CSS
#fadeblock {
display:none;
position:fixed;}
#sidebar {
width:200px;
height:200px;
padding:450px 20px 20px 20px;
position:absolute;
margin-left:3%;
}
HTML:
<div id="fadeblock">
<div id="sidebar">
<div id="title">{Title}</div>
<div id="desc">{Description}</div>
<div id="links">
<a href="/">link</a>
<a href="/">link</a>
<a href="/">link</a>
<a href="/">link</a>
</div>