I need to detect when an HTML element has been completely hidden, I have found many examples and most detect when the div touches the top of the document, in the example is a green line, what I want is to detect when this green line is hidden with the movement of croll.
Edit: I need to detect when the green line that is just after the closing of the label and when it reaches the Top with the movement of the user's Scroll, not detect when the opening of the element that has the edge reaches the top, if not when the closing of the the label that has the green border reaches the top, which is when the complete DIV would be hidden.
$(function(){
$(window).on('scroll', function() {
var scrollTop = $(window).scrollTop();
var elementOffset = $('.element').offset().top;
var currentElementOffset = (elementOffset - scrollTop);
console.log( currentElementOffset );
});
});
body {
display: block;
min-height: 1250px;
border-bottom: 2px;
}
#content {
display: block;
min-height: 250px;
border-bottom: 5px solid rgb(121,185,0);
background-color: rgb(250,250,250);
}
#content:after {
content: "";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="content">
<div class="element"></div>
</div>