How to use jQuery Mobile for its touch event support only (no UI enhancements)?

前端 未结 8 668
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 07:09

I’m working on a web app that has its own look and feel. I want to use jQuery Mobile for the touch events support only.

When I link jquery.mobile.min.js (without li

8条回答
  •  粉色の甜心
    2020-12-04 07:33

    In case anyone else runs into this (and doesn't need the file off one of jQuery's CDNs), here are the steps I took to extract just the JQM event triggers:

    1. git clone git@github.com:jquery/jquery-mobile
    2. cd jquery-mobile
    3. edit js/jquery.mobile.js in your favorite editor
    4. replace the define(...); statement with define(['./events/touch', './events/orientationchange']);
    5. make
    6. your events-only JQM is now in compiled/jquery.mobile.js and compiled/jquery.mobile.min.js

    Now you can use $(el).tap(fn) and the like without worrying about JQM highjacking your markup!

提交回复
热议问题