Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Created February 6, 2014 20:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tourdedave/8851561 to your computer and use it in GitHub Desktop.
Save tourdedave/8851561 to your computer and use it in GitHub Desktop.
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="/js/waypoints.min.js"></script>
<script>
$(function() {
var promo = $('#promo'),
speed = 500; //speed in ms
$('.promo-hook').waypoint(function(direction){
if (direction === "down") {
promo.slideDown(speed);
}
if (direction === "up") {
promo.slideUp(speed);
}
}, {
offset: function() {
return -$(this).height();
}
});
$('#close').click(function(){
promo.slideUp(speed,function(){
promo.remove();
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment