Created
October 8, 2013 17:50
-
-
Save anonymous/6888615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header{ | |
width:100%; | |
height:200px; | |
background:teal; | |
} | |
.ad{ | |
width:500px; | |
height:120px; | |
margin:0 auto; | |
background:red; | |
} | |
article{ | |
width:100%; | |
height:1500px; | |
background:yellow; | |
} | |
.ad2{ | |
width:500px; | |
height:120px; | |
margin:0 auto; | |
background:blue; | |
display: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> | |
<div class='ad2'> | |
<p> some content</p> | |
</div> | |
</header> | |
<article></article> | |
</body> | |
</html> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$(window).scroll(function(){ | |
var aTop = $('.ad').height(); | |
if($(this).scrollTop()>=aTop){ | |
$(".ad2").show(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment