Skip to content

Instantly share code, notes, and snippets.

@psteinweber
Created January 13, 2014 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psteinweber/8396832 to your computer and use it in GitHub Desktop.
Save psteinweber/8396832 to your computer and use it in GitHub Desktop.
This small gist allows creating "Share buttons" (or something else) which fade in and while the content is in the viewport.
.post-sharing-side {
position: fixed;
top: 50%;
right: 50%;
margin-right: -530px;
}
$('.post-sharing-side').hide();
var entryheight = $('.entry-content').height();
$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 350 && y < entryheight) {
$('.post-sharing-side').fadeIn();
} else {
$('.post-sharing-side').fadeOut();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment