jQuery 和 jQuery Mobile 的区别? [英] Difference between jQuery and jQuery Mobile?

查看:19
本文介绍了jQuery 和 jQuery Mobile 的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是移动网络开发的新手,我刚刚使用 PhoneGap 制作了一个移动应用程序,经常使用 jQuery.

I'm new to mobile web development, and I just made a mobile-app with PhoneGap, employing frequent use of jQuery.

但自然有一些与我如何格式化事物以及它们在我正在测试的移动设备屏幕上实际出现的方式有关的故障,在尝试解决这些问题时,我偶然发现了许多建议,以使事情变得更容易我自己使用 jQuery mobile.

But there were naturally a couple of glitches related to how I formatted things and the way they actually appeared on the mobile device screens I was testing with, and in trying to work these out I stumbled across many suggestions to make things easier on myself by using jQuery mobile.

现在这让我很困惑——jQuery 在格式上没有任何作用.这只是我对移动 CSS 的初学者水平的知识,导致了这些问题.

Now this confuses me-- jQuery had no roll in formatting. That was just my beginner's level knowledge of mobile CSS that caused the problems.

那么jQuery mobile究竟是做什么的,它和普通的jQuery有什么不同?如果我已经知道 jQuery,那么对我来说什么是新的?

So what exactly does jQuery mobile do, and how is it different from ordinary jQuery? If I already know jQuery, what's going to be new to me?

推荐答案

jQuery 纯粹旨在简化和标准化跨浏览器的脚本.它专注于底层的东西:创建元素、操作 DOM、管理属性、执行 HTTP 请求等.

jQuery is purely designed to simplify and standardise scripting across browsers. It focuses on the low-level stuff: creating elements, manipulating the DOM, managing attributes, performing HTTP requests, etc.

jQueryUI 是一组用户界面组件建立在 jQuery 之上的功能(即它需要 jQuery 才能工作):按钮、对话框、滑块、选项卡、更高级的动画、拖放功能.

jQueryUI is a set of user interface components & features built on top of jQuery (i.e. it needs jQuery to work): buttons, dialog boxes, sliders, tabs, more advanced animations, drag/drop functionality.

jQuery 和 jQueryUI 都旨在添加"到您的网站(桌面或移动) - 如果您想添加特定功能,jQuery 或 jQueryUI 可能会有所帮助.

jQuery and jQueryUI are both designed to be 'added' to your site (desktop or mobile) - if you want to add a particular feature, jQuery or jQueryUI might be able to help.

jQuery Mobile 是一个完整的框架.它旨在成为您创建移动网站的起点.它需要 jQuery 并利用 jQuery 和 jQueryUI 的特性来提供 UI 组件和 API 特性来构建移动友好的站点.您仍然可以随心所欲地使用它,但如果您愿意,jQuery Mobile 可以以移动友好的方式控制整个视口.

jQuery Mobile, however, is a full framework. It's intended to be your starting point for a mobile site. It requires jQuery and makes use of features of both jQuery and jQueryUI to provide both UI components and API features for building mobile-friendly sites. You can still use as much or as little of it as you like, but jQuery Mobile can control the whole viewport in a mobile-friendly way if you let it.

另一个主要区别是 jQuery 和 jQueryUI 旨在成为 HTML 和 CSS 之上的层.您应该能够单独留下您的标记并使用 jQuery 对其进行增强.但是,jQuery Mobile 提供了单独使用 HTML 来定义您希望组件出现的位置的方法 - 例如(来自 jQuery Mobile 网站):

Another major difference is that jQuery and jQueryUI aim to be a layer on top of your HTML and CSS. You should be able to just leave your markup alone and enhance it with jQuery. However, jQuery Mobile provides ways to define where you want components to appear using HTML alone - e.g. (from the jQuery Mobile site):

<ul data-role="listview" data-inset="true" data-filter="true">
    <li><a href="#">Acura</a></li>
    <li><a href="#">Audi</a></li>
    <li><a href="#">BMW</a></li>
    <li><a href="#">Cadillac</a></li>
    <li><a href="#">Ferrari</a></li>
</ul>

data-role 属性告诉 jQuery Mobile 将此列表转换为适合移动设备的 UI 组件以及 data-insetdata-filterattributes 设置它的属性 - 无需编写一行 JavaScript.另一方面,jQueryUI 组件通常是通过编写几行 JavaScript 来在 DOM 中实例化组件来创建的.

The data-role attribute tells jQuery Mobile to turn this list into a mobile-friendly UI component and the data-inset and data-filter attributes set properties of that - without writing a single line of JavaScript. jQueryUI components, on the other hand, are normally created by writing a few lines of JavaScript to instantiate the component in the DOM.

这篇关于jQuery 和 jQuery Mobile 的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆