Update position.js

Fix "Unable to get value of the property 'scrollX': object is null or undefined"