Reputation: 539
I'm trying to unload a request that JqueryMobile is caching. On nearly all of my pages I use FastClick.js as it greatly decreases my click speed. This script is activated using onload="initFastButtons();" on the body tag. Is there a way that I can kill that request on certain pages? It is causing issues with some of my links on a particular page that I don't need fastclick. If I could just remove it, it would help with my issue. Let me know, thanks!
Upvotes: 1
Views: 275
Reputation: 5267
The HTML5 spec allows you to add data-xxx attributes on all elements to store metadata that you can use in your Javascript. This can be anything you like - with string data of course. So you can add an attribute to your body tag like so -
The next thing is to run your fastbutton code on a Jquery Mobile event rather than the body load. Have a look here http://jquerymobile.com/demos/1.1.0/docs/api/events.html. You probably want to use the pageload or pagebeforeshow event.
When your event handler for the load event is called, you want to use the jqmData method (described here http://jquerymobile.com/demos/1.1.0/docs/api/methods.html) to check whether the body tag has the fastbuttons attribute. If it does, run the code to initialise the fastbuttons.
I am not familiar with fastbuttons so don't know how it caches stuff.
Upvotes: 1