refactored position sticky polyfill (fixes #428)