ftlabs/fastclick — pull request #126 by Mobideck (2013-06-09 10:14:26+00:00)
Title: Temporarily disable/enable fastclick

I use fast click in an iPhone application.

There were some issues with scrolling the UIWebView and touch: sometime when I stop scrolling by a tap, fastclick take it as a click.

After some research, I find that the an easy way to do deal with this is to disable fastclick when I start scrolling and enable it when I stop.

So I had an option in fastclick to do that:

```fastclick.trackingDisabled = true/false;```

And to use it in Objective-C code, it look like something like that:

```
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
[webView stringByEvaluatingJavaScriptFromString:@"if (typeof(fastclick) != 'undefined') fastclick.trackingDisabled = true;"];
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
[webView stringByEvaluatingJavaScriptFromString:@"if (typeof(fastclick) != 'undefined') fastclick.trackingDisabled = false;"];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (scrollView.isDecelerating == NO)
{
[webView stringByEvaluatingJavaScriptFromString:@"if (typeof(fastclick) != 'undefined') fastclick.trackingDisabled = false;"];
}
}
```