minor refactoring of sticky navigation js
renamed function to be more clear