Created
August 17, 2016 16:07
-
-
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
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
$($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