Skip to content

Instantly share code, notes, and snippets.

@jperl
Created May 4, 2014 18:15
Show Gist options
  • Save jperl/09e1b38b64404c2bf84a to your computer and use it in GitHub Desktop.
Save jperl/09e1b38b64404c2bf84a to your computer and use it in GitHub Desktop.
Force a scrollview to a position
/**
* Force a scrollview to a position
*/
var forcePosition = function (scrollview, position, noSpring) {
if (noSpring) {
scrollview._springState = 0;
scrollview._physicsEngine.detachAll();
}
scrollview.setVelocity(0);
scrollview.setPosition(position);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment