Skip to content

Instantly share code, notes, and snippets.

@ascot21
Created December 17, 2013 22:35
Show Gist options
  • Save ascot21/8013893 to your computer and use it in GitHub Desktop.
Save ascot21/8013893 to your computer and use it in GitHub Desktop.
$ ->
$(window).scroll ->
if $(window).width() > 640
$widget = $(".sidebar-widget")
$position = $widget.offset().top
$breakPosition = $('.author-bio').offset().top
if ($(window).scrollTop() > $('.post-header').height()) && ($position < $breakPosition)
$widget.stop().animate marginTop: $(window).scrollTop() - $('header').height() - 155
else
$widget.stop().animate marginTop: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment