Jack Flint
Jack Flint

Reputation: 238

How to snap to sections in a WinJS.UI.Hub control

Is there a way in a Windows 8 app using HTML/JS to snap the user's panning of a Hub control only to each Hub Section so that the user always lands exactly on a section?

Upvotes: 0

Views: 753

Answers (1)

Mike Mastrangelo
Mike Mastrangelo

Reputation: 26

Try switching the Snap Point Type from Proximity to Mandatory:

.win-hub-viewport {
    -ms-scroll-snap-type: mandatory;
}

http://msdn.microsoft.com/en-us/library/windows/apps/hh466057.aspx

Possible values are:

  • none: Initial value. Panning and scrolling are unaffected by any defined snap-points. Touch flicks will result in normal inertia.
  • proximity: When normal inertia would leave content near a snap point, inertia is adjusted to land exactly on the snap point. However, it is still possible to land between snap points.
  • mandatory: Inertia is adjusted to ensure content always lands on a snap point.

Upvotes: 1

Related Questions