bradbirdsall/Swipe — pull request #385 by georgethomasuk (2013-10-23 15:14:00+00:00)
Title: Add canSwipeTo function to optional parameters

Provide an option to test whether any individual slide change is valid.

The function is provided in as the 'canSwipeTo' key of the options object. And if provided is then run prior to any change in slide being made.

If the new slide is not valid to move to, then Swipe will follow the same behaviour as if it had reached the end of the slides.

## Example Use Case:

Swipe is being used to hold a calendar, where the user can swipe from month to month. At certain times the user should be able to swipe through the full set of months. At other points it may be desirable to restrict the range of months that can be seen.

The optional canSwipeTo test allows this condition to be implemented dynamically, without having to rebuild the Swipe object.