-
-
Save iamdustan/b15d32c6780ef3170a1b to your computer and use it in GitHub Desktop.
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
function highlyExpensiveFunction(elementNode) { | |
$(elementNode).css({ | |
'position': 'fixed' | |
}); | |
offsetTop = $(elementNode).offset().top; | |
offsetLeft = $(elementNode).offset().left; | |
anotherExpensiveFunction(elementNode, offsetTop, offsetLeft); | |
return elementNode; | |
} | |
// Let’s finish setting up this short example by calling this with some setup code. | |
function initExpensiveWork(elementNode) { | |
$(elementNode).on('scroll', function () { | |
highlyExpensiveFunction(elementNode); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment