博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools_MooTools Mobile:令人感动!
阅读量:2512 次
发布时间:2019-05-11

本文共 3825 字,大约阅读时间需要 12 分钟。

mootools

iPad, iPhone, iOS

When the community asked the MooTools team to add basic mobile event listening to MooTools' Event class, we listened; today . What if we want more detailed mobile event listeners though, like swipe with direction, pinch, or touchhold events? That's where Christoph Pojer's excellent comes in. MooTools Mobile isn't a full mobile framework, but rather a set of utilities to make catering to mobile a bit more...touching. Let's have a look at the resources provided by MooTools Mobile!

当社区要求MooTools团队添加监听MooTools的Event类的基本移动事件时,我们进行了监听; 今天, 。 但是,如果我们想要更详细的移动事件侦听器,如通过方向滑动,捏或触摸事件,则该怎么办? 这就是Christoph Pojer出色的出现的地方。MooTools Mobile并不是一个完整的移动框架,而是一组实用程序,可以更好地满足移动用户的需求。 让我们看一下MooTools Mobile提供的资源!

As you've come to expect from members of the MooTools team, Christoph's new Touch-based event classes are compact and modular. Each class will be found within the Touch path.

正如您对MooTools团队成员所期望的那样,Christoph基于触摸的新事件类是紧凑和模块化的。 每个类别都可以在“触摸”路径中找到。

滑动 (Swipe)

By using the Touch/Swipe resource, you can attain the direction of the swipe, as well as the start and end coordinates:

通过使用“ Touch/Swipe资源,您可以获得Touch/Swipe的方向以及开始和结束坐标:

// Add the swipe event listeneranyElement.addEvent("swipe", function(event){    event.direction // "left" or "right"    event.start // {x: Number, y: Number} Swipe start position    event.end // {x: Number, y: Number} Swipe end position});// Configure minimal swipe distance and vertical swipe preferencesanyElement.store("swipe:distance", 30); // Default: 50anyElement.store("swipe:cancelVertical", true); // Default: false

As you can see above, you may also configure minimum swipe distances and cancellation of vertical swipes.

如上所示,您还可以配置最小滑动距离和取消垂直滑动。

(Pinch)

The Touch/Pinch resource allows you to listen for pinches, as well as configure the pinch threshold:

Touch/Pinch资源使您可以监听捏,以及配置捏阈值:

// Add a pinch event to anyElementanyElement.addEvent("pinch", function(event){    event.pinch // "in" or "out"});// Store a custom thresholdanyElement.store("pinch:threshold", 0.3); // Default: 0.5; Amount of scaling to be done to fire the pinch event

The pinch threshold is stored within elements themselves so you may customize to fit any element.

收缩阈值存储在元素本身中,因此您可以自定义以适合任何元素。

触屏 (Touchhold)

The touchhold event is used throughout all mobile operating systems, so why not implement touchhold within the browser?

所有移动操作系统都使用touchhold事件,那么为什么不在浏览器中实现touchhold?

//  Listen for touchhold on anyElementanyElement.addEvent("touchhold", function(event){    // Event fires});

Any element may store an optional delay before the touchhold event fires:

在touchhold事件触发之前,任何元素都可以存储可选的延迟:

anyElement.store("touchhold:delay", 1000); // Default: 750

Maximum versatility with minimal code!

以最少的代码实现最大的多功能性!

浏览器增强! (Browser Enhancements!)

Besides providing these custom touch events, MooTools Mobile provides additional information within the Browser object via a Device property:

除了提供这些自定义的触摸事件外,MooTools Mobile还通过Device属性在Browser对象中提供了其他信息:

Browser.Device // Object added to Browser	Browser.Device.name // ipad / iphone / ipod OR other	Browser.Device.ipad // true if on ipad	Browser.Device.iphone // true if on iphone	Browser.Device.ipod // true if on ipod	Browser.hasHighResolution // true on iPhone 4	Browser.isMobile // True on any platform that is not Windows / Linux / Mac

These properties give you further insight as to the device capabilities!

这些属性使您可以进一步了解设备功能!

With mobile development booming for the foreseeable future, it's important to make sure your site is as mobile-friendly as possible. Christoph's mobile contribution is just the tiny helper developers may need to make their MooTools-powered web apps more mobile device-friendly. MooTools (Mobile) FTW!

在可预见的未来,随着移动开发的蓬勃发展,确保您的网站尽可能地适合移动设备使用非常重要。 Christoph的移动贡献只是开发人员可能需要的微小帮助者,以使其基于MooTools的Web应用程序对移动设备更加友好。 MooTools(移动)FTW

翻译自:

mootools

转载地址:http://cupwd.baihongyu.com/

你可能感兴趣的文章
3283
查看>>
嘉为科技获得腾讯投资,拓展企业级IT运营管理市场
查看>>
java得到日期相减的天数
查看>>
安装denyhosts3.1版本报错如下
查看>>
12.1.2: How to Modify and Enable The Configurable Home Page Delivered Via 12.1.2 (Doc ID 1061482.1)
查看>>
Understanding Item Import and Debugging Problems with Item Import (Doc ID 268968.1)
查看>>
Alpha版总结会议
查看>>
Java--面试通关要点
查看>>
iOS 消息推送原理
查看>>
随笔1
查看>>
Codeforces 731 C.Socks-并查集+STL(vector+map)
查看>>
洛谷 P3383 【模板】线性筛素数-线性筛素数(欧拉筛素数)O(n)基础题贴个板子备忘...
查看>>
C语言中的正负数及其输出以及小数
查看>>
Android Fragments 详细使用
查看>>
【转】MySQL-Utilities,mysql工具包
查看>>
使用echarts实现了一个折现图,数据是一天24小时
查看>>
杂项:game_navigation
查看>>
建站手册-职业规划:职业资源
查看>>
基于 Generator 和 Iterator 的惰性列表
查看>>
身为前端开发工程师,你需要了解的搜索引擎优化SEO.
查看>>