如何仅将jQuery Mobile用于其触摸事件支持(不增强UI)? [英] How to use jQuery Mobile for its touch event support only (no UI enhancements)?
问题描述
我正在开发具有自己的外观和风格的网络应用程序.我只想将jQuery Mobile用于触摸事件支持.
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.
当我链接jquery.mobile.min.js(不链接CSS)时,我的页面布局被破坏了.
When I link jquery.mobile.min.js (without linking the css), then the layout of my page is broken.
如何配置(初始化)jQuery Mobile以仅使用触摸事件支持?因为我没有任何与JQM页面相关的事件,我将这些事件绑定到jQuery文档就绪挂钩中吗?
How can I configure (initialize) jQuery Mobile to only use touch events support? Would I bind the events in the jQuery document ready hook since I'd not have any JQM page related event?
修改
请参见jsfiddle中的以下示例: http://jsfiddle.net/redhotsly/JGgrw/. html包含<button>
,但是jQuery Mobile在其左侧创建了<span>
.如果检查生成的标记(F12),您会看到jQuery Mobile也向我的按钮添加了CSS类.
See this example in jsfiddle: http://jsfiddle.net/redhotsly/JGgrw/. The html contains a <button>
but jQuery Mobile created a <span>
to its left. If you inspect the resulting markup (F12) you will see that jQuery Mobile also added a CSS class to my button.
我需要一个无需修改JQM脚本的解决方案.我需要在CDN上使用官方脚本.
I need a solution where I'll not have modify the JQM script. I need to use the official script off a CDN.
推荐答案
如果您只想绑定触摸/手势事件,我会改用jGestures:
If you just want to bind to touch/gesture events I'd use jGestures instead:
http://jgestures.codeplex.com/
我以前在项目上使用过的漂亮的小jQuery插件,具有很多绑定到的事件:
Nice little jquery plugin that I've used on projects before with a big range of events to bind to:
可用事件:
orientationchange (设备方向改变).此事件由设备触发,可能会使用 内部陀螺仪.
orientationchange The device is turned clockwise or counterclockwise. This event is triggered by the device and might use an internal gyroscope.
收缩(在捏手势(两个手指相互远离或靠近的方向上移动)期间触发).
pinch Is triggered during a pinch gesture (two fingers moving away from or towards each other).
旋转在旋转手势(两个手指顺时针或逆时针旋转)期间触发.
rotate Is triggered during a rotation gesture (two fingers rotating clockwise or counterclockwise).
滑动是在滑动手势(手指在设备周围移动(例如拖动))期间触发的
swipemove Is triggered during a swipe move gesture (finger(s) being moved around the device, e.g. dragging)
swipeone (swipeone)是在用一个接触点(在设备上移动了一根手指)滑动手势后触发的.
swipeone Is triggered after a swipe move gesture with one touchpoint (one finger was moved around the device)
swipetwo (滑动两个手势)(在设备上移动了两个手指)时触发了该手势
swipetwo Is triggered after a swipe move gesture with two touchpoints (two fingers were moved around the device)
swipethree (滑动),带有三个接触点的滑动手势(在设备周围移动了三个手指)后被触发
swipethree Is triggered after a swipe move gesture with three touchpoints (three fingers were moved around the device)
swipefour 是在具有四个接触点的滑动手势(围绕设备移动了四个手指)后触发的.
swipefour Is triggered after a swipe move gesture with four touchpoints (four fingers were moved around the device)
滑动是在严格向上滑动手势后触发的
swipeup Is triggered after an strict upwards swipe move gesture
swiperightup (向右向上滑动手势)
swiperightup Is triggered after a rightwards and upwards swipe move gesture
滑动是在严格向右滑动手势后触发的
swiperight Is triggered after a strict rightwards swipe move gesture
swiperightdown (向下滑动)是在绑定*向后和向下滑动移动手势后触发的
swiperightdown Is triggered after a rig*htwards and downwards swipe move gesture
轻扫是在严格向下滑动手势后触发的
swipedown Is triggered after a strict downwards swipe move gesture
swipeleftdown (向左向下滑动手势)后触发
swipeleftdown Is triggered after a leftwards and downwards swipe move gesture
向左滑动是在严格向左滑动手势后触发的
swipeleft Is triggered after a strict leftwards swipe move gesture
swipeleftup (向左向上滑动手势)后触发
swipeleftup Is triggered after a leftwards and upwards swipe move gesture
tapone (
tapone ),只需单击一个手指(一个手指)即可触发
tapone Is triggered after a single (one finger) tap gesture
taptwo 是在双击(两根手指)点击手势后触发的
taptwo Is triggered after a double (two finger) tap gesture
tapthree (三触)(三指)点击手势后触发
tapthree Is triggered after a tripple (three finger) tap gesture
pinchopen 在发生捏开手势(两个手指彼此分开)并且接触点(手指)处于 删除了设备.
pinchopen Is triggered when a pinchopen gesture (two fingers moving away from each other) occured and the touchpoints (fingers) are removed the device.
pinchclose 发生捏合手势(两个手指朝彼此移动)并且接触点(手指)处于 删除了设备.
pinchclose Is triggered when a pinchclose gesture (two fingers moving towards each other) occured and the touchpoints (fingers) are removed the device.
rotatecw 发生顺时针旋转手势(两个手指顺时针旋转)并且触摸点(手指)处于 删除了设备.
rotatecw Is triggered when a clockwise rotation gesture (two fingers rotating clockwise) occured and the touchpoints (fingers) are removed the device.
rotateccw 发生逆时针旋转手势(两个手指逆时针旋转)并且接触点触发 (手指)已删除设备.
rotateccw Is triggered when a counterclockwise rotation gesture (two fingers rotating counterclockwise) occured and the touchpoints (fingers) are removed the device.
这篇关于如何仅将jQuery Mobile用于其触摸事件支持(不增强UI)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!