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

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

问题描述

我是移动Web开发的新手,我刚刚使用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-filter属性设置了该属性-无需编写任何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天全站免登陆