I am using scrollTop() event to show/hide div in certain position also I am using onClick() event to permanently hide div, the event is working good but the problem is that when i scrolling page then the div showing again.
My code is as under.
Javascript code
<script type="text/javascript">
$(document).scroll(function() {
if (screen.width > 768) {
var y = $(this).scrollTop();
if (y < 500) {
$('.benchdiv').fadeOut();
}
else {
$('.benchdiv').fadeIn();
}
}
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".removebg").click(function(){
$(".benchdiv").hide();
});
});
</script>
HTML Code
<div class="benchdiv">
<a href="http://www.benchmarkemail.com?p=636276" target=_blank><img src="//www.benchmarkemail.com/images/partner/banners/125x125.gif" width="125" height="125" border="0" /></a>
<div class="benchremove"><a href="javascript:void(0);" class="removebg glyphicon glyphicon-remove"></a></div>
</div>