解决方法
尝试这样:
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(); } }); });