2

I want to implement swipe gestures in my mobile site but dont want to include the entire jquery mobile library as it messes with certain server calls. Can I only include a minified jquery mobile library that only supports the swipe gestures?

3
  • Would you be ok with including vanilla jquery library?
    – spicavigo
    Dec 13, 2011 at 7:08
  • yes.. absolutely. its already included.
    – amit
    Dec 13, 2011 at 9:00
  • there is a multitude of stand-alone mobile touch libraries that are not related to jquery - did you try those?
    – Leon
    Dec 13, 2011 at 11:13

3 Answers 3

2

In RC1 Release Notes they jQM Team stated that the widgets are now decoupled:

Download builder: In the works

Now that we’ve decoupled most of the UI widgets, we’ve set the stage for there to be a download builder. This will let you build a custom version of jQuery Mobile to only include the parts you need. For example, you could just use the core files to add Ajax-based navigation with pushState and leverage some of the touch events and other utilities with a very lightweight build (roughly 10k). Or, you could add in specific UI widgets like form elements, listviews, etc. to create an optimized build. We’re aiming to have a download builder tool launch as part of 1.0 final in some form. We’re working on a dependency map now for all the plugins to support this tool.

Until the Download Builder is released you can always head over to Github and download the decoupled widget:

Here are the events

Edit: Download builder is now available.

http://jquerymobile.com/download-builder/

2
  • which js files do i need to include so that the swipe events are handled?
    – amit
    Dec 14, 2011 at 6:47
  • 1
    @amit, you need 'events' and you might need 'mouse' (test in your project).
    – daan
    Dec 14, 2011 at 9:45
1

As of the jQuery Mobile 1.2.0 release, they now offer a download builder that allows you to only download what you want.

Learn More: http://jquerymobile.com/download-builder/

0

Try simply copying the bits you need! As far as I can tell (just had a quick peek in the code, haven't read everything), you can get away by copying line 485 - 1297 from the source (found here: http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.js). This part includes tap and swipe events, but also device rotate events etc. In the source, they're marked as the 'mouse' plugin and the 'events' plugin.

Don't forget to compress the extracted lines afterwards!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.