Skip to content

Instantly share code, notes, and snippets.

@jrencz
Created August 17, 2016 16:07
Show Gist options
  • Save jrencz/27065fd81ed4c7cfd01cd79bfd08f8b0 to your computer and use it in GitHub Desktop.
Save jrencz/27065fd81ed4c7cfd01cd79bfd08f8b0 to your computer and use it in GitHub Desktop.
How can one tell well written angular app? When he sees this and it's still ~60fps on a decent laptop
$($window).on('scroll', function () {
scope.$apply(function () {
if ($window.pageYOffset > offsetTop) {
elem.css('left', offsetLeft + 'px');
elem.css('width', width + 'px')
// position: fixed; top: 100px;
elem.addClass('sticky');
} else {
elem.removeClass('sticky');
elem.css('left', '');
elem.css('width', '');
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment