Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <header>
    <div class='ad'></div>
  </header>
  <article></article>
</body>
</html>
 
header{
  width:100%;
  height:200px;
  background:teal;
}
.ad{
width:500px;
  height:120px;
  margin:0 auto;
  background:red;
}
article{
  width:100%;
  height:1500px;
  background:yellow;
}
 
$(function(){
  $(window).scroll(function(){
    var aTop = $('.ad').height();
    if($(this).scrollTop()>=aTop){
        alert('ad just passed.');
    }
  });
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers