ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.23k forks source link

FastClick not working with JQuery and Phonegap? #205

Closed ldeluca closed 10 years ago

ldeluca commented 10 years ago

Also posted to the google group for phonegap: https://groups.google.com/forum/#!topic/phonegap/sl4zBXZvbuE

I am using fastclick and jquery and followed the instructions from the fastclick git repos to install and use https://github.com/ftlabs/fastclick

I am using jquery to move between pages in my single page app. I thought part of my problem might just be that the pages takes a while to load. So I decide to show a spinner when someone clicks to move to another page.

//when the click occurs I show the spinner then call a method to transition to the right page $('.next').bind('click', function(e) { $('#spinner').show(); goToPage(myName, false); });

//when the page loads I hide the spinner $('[data-role="page"]').on('pageshow',function(event, ui){ $('#spinner').hide(); });

After I click on a "next" button it takes 5 or 6 seconds before the spinner shows. and by the time the spinner shows the page that was to be transitioned to shows immediately and the spinner disappears. So I'm assuming the fastclick isn't working since my spinner doesn't display right away.

I followed the instructions for fastclick.
//fast click $(function() { FastClick.attach(document.body); });

and included the js.

See anything I'm doing wrong with how I attach the click event or getting fastclick to work?

matthew-andrews commented 10 years ago

I'm afraid I can't really help with this issue without a reduced test case, more details about which browsers/devices are behaving slowly, etc. Sorry.