在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):cpojer/mootools-mobile开源软件地址(OpenSource Url):https://github.com/cpojer/mootools-mobile开源编程语言(OpenSource Language):JavaScript 96.6%开源软件介绍(OpenSource Introduction):MobileMakes your web applications more touching. Provides custom events and useful browser information for mobile web (application) development. On iOS it provides a touch event handler that automatically replaces all your click handlers with touch events to overcome the ~300ms click delay. Requires MooTools Core 1.3. This Plugin is part of MooTools PowerTools!. BuildBuild via Packager, requires MooTools Core and MooTools Custom Event to be registered to Packager already
To build this plugin without external dependencies use
Supported DevicesTested and supported are the following devices:
Note: no other mobile browsers support touch events currently. How To UseIf you include Touch/Click.js (and dependencies) into your application, all click events will automatically be replaced with touch events.
For more information see the included Demo. Touch Custom EventThe replacement for click events is optional. If you choose to include Touch/Touch.js (and dependencies) without Click.js, your click event listeners will stay untouched and you get a custom 'touch' event instead.
The requirement for the touch and click events to fire is to start and end the touch on the same element. Swipe Custom EventThe file Touch/Swipe.js provides a custom swipe event for your elements. Only works for 'left' and 'right' as moving up and down is reserved for scrolling.
Additionally there are some options for swipe events
Pinch Custom EventThe file Touch/Pinch.js provides a custom pinch event for your elements
Additionally there is a threshold option for pinch events
Touchhold Custom EventThe file Touch/Touchhold.js provides a custom touchhold event for your elements
Additionally there is delay option for touchhold events
Browser InformationTo support "touchhold" and "swipe" on desktop devices without touch input you can include Desktop/Mouse.js. It maps mouse* events to touch* events. To execute code on browsers with touch events available use Browser/Features.Touch.js
Note that Chrome 5 reports to support touch events. This behavior has been fixed in Chrome 6 at least when no touch input devices are available. The "iOSTouch" property is only true on more sophisticated platforms such as mobile safari. This property is useful to detect whether click events should be replaced with touch events on iOS. You shouldn't need to access this property, but you may find it useful.
Access useful information about the browser environment via Browser/Mobile.js
TipsFor an optimal experience use the following CSS Styles
For elements with touch events use
In addition to that, because the code uses "document.elementFromPoint", it is wise to set pointer-events to none for elements within click handler elements. Usually "a *" as a selector is sufficient, but it should be applied to any overlaying elements that might get in your way.
Also, to prevent moving the whole page in iOS you can add this script
ToDo
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论