Try this: http://jsbin.com/axaler/3/edit
$(function(){
$(window).scroll(function(){
var aTop = $('.ad').height();
if($(this).scrollTop()>=aTop){
alert('header just passed.');
// instead of alert you can use to show your ad
// something like $('#footAd').slideup();
}
});
});
See jQuery.scroll(). You can bind this to the window element to get your desired event hook.
On scroll, then simply check your scroll position:
$(window).scroll(function() {
var scrollTop = $(window).scrollTop();
if ( scrollTop > $(headerElem).offset().top ) {
// display add
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With