Search code examples
touchzurb-foundation

Fastclick for touch devices with ZURB Foundation?


If I create a responsive website using ZURB's Foundation, will I need to include a library like Fastclick (by FTLabs) in order to avoid the 300 ms click delay on touch devices?

Seems the library should include this since getting things to act nice on mobile is its main purpose.

I guess, when I think about it, it seems that fastclick should be included on every single website that needs to be displayed on a touch device - or not...?


Solution

  • Seems like the old accepted answer is not valid anymore. Fastclick is used by Foundation now.

    Found this on Foundation Github repo when searching for "Fastclick" there:

    Result of Fastclick search in Foundation Github Repo

    (From https://github.com/zurb/foundation/search?utf8=%E2%9C%93&q=fastclick)

    Also, I found this on Foundation Github repo:

      // Enable FastClick if present
      $(function () {
        if (typeof FastClick !== 'undefined') {
          // Don't attach to body if undefined
          if (typeof document.body !== 'undefined') {
            FastClick.attach(document.body);
          }
        }
      });
    

    (Source from: https://github.com/zurb/foundation/blob/d2c9a9a7e84e53e5eff41ac2f61a8425f0760086/js/foundation/foundation.js)

    So, this basically means that you can use Fastclick if you want and Foundation will initialize it for you but you can also decide to exclude if from your libs and Fastclick will not be used.