I want a hidden
div
show if he passed the another DIV. for example show in html
below if div.passedMe
bottom! meet the top of the window, the div.showHide
will show and when scroll up
and the div.passedMe
top! meet the top of the window the div.showHide
will hide.
Html
<div class="passedMe">If you passed this div another div will show/hide</div>
<div class="showHide"> this div will show/hide</div>
so far this is what I have but this only work when passed a certain PIXEL
on A page
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 100) {
$('.showHide').fadeIn();
} else {
$('.showHide').fadeOut();
}
});
this is the fiddle
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…