Open ghost opened 11 years ago
Instead of attachFastClick(document);
try attachFastClick.attach(document.body);
.
I have the same problem and your suggestion dose not work for me. Any other idea? Thanks
I just wanted to chime in I was having a similar problem using FC with require, and it was returning a FastClick object, not the attachFastClick function. Changing my code to call the attach method on the returned FactClick object worked just fine for me.
Thanks @cilogi.
Same here, please update the documentation.
Hi @eladxxx @noslouch @cilogi - we actually don't have any docs for AMD/RequireJS - the README (it's a bit unfortunate we've made the API FastClick exposes in CommonJS different from AMD but it's probably too late to fix that now). Would happily accept a pull request from someone using RequireJS to add docs for it as it's not something I've ever used before...
You're right - I was looking at the CommonJS section. Here's what works for me in RequireJS:
define([
"fastclick",
], function(fastclick) {
fastclick.attach(document.body);
});
Does the above snippet work for everyone else?
Yeah that's what I"m using. I can submit a PR to update the docs if you need.
On Mon, Feb 3, 2014 at 8:46 AM, Matt Andrews notifications@github.comwrote:
Does the above snippet work for everyone else?
— Reply to this email directly or view it on GitHubhttps://github.com/ftlabs/fastclick/issues/150#issuecomment-33955156 .
This problem still exists. FastClick constructor is exported instead of FastClick.attach in webpack.
var FastClick = require('fastclick'); FastClick.attach(document.body);
It can work for me, hope to help for you!
var FastClick = require('fastclick'); FastClick.attach(document.body);
It can work for me, hope to help for me!
Hi there!
I am using the fastclick plugin in my mobile web app project. I am getting the error
Cannot set property 'trackingClick' of undefined
when I try to call the FastClick.attach function. I guess the problem is the lazy loading of require.js. The documentation tells me, that the plugins supports AMD, but it seems that I am doing something wrong.
I tried to call it in different places of the app (it is a Backbone Marionette App). e.g. app initialize, app onStart or even in a onShow-Method of my layout. So I think it couldn't be a document.ready issue.
I used this code to attach fastclick:
var attachFastClick = require(['fastclick']); attachFastClick(document);
Does anybody made fastclick and require.js work together?
Best Christofer