Javascript jQuery vs jQuery Mobile vs jQuery UI?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6636388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 22:34:23  来源:igfitidea点击:

jQuery vs jQuery Mobile vs jQuery UI?

javascriptjqueryjquery-uijquery-mobile

提问by Chan Le

I'm new to web development and there are just too many j* stuff out there. I wonder what are the differences between these frameworks?

我是 Web 开发的新手,那里有太多 j* 的东西。我想知道这些框架之间有什么区别?

Moreover, why do people talk a lot about making a plugin using jQuery? Isn't it supposed to be a JavaScript library to make your web page more interactive?

此外,为什么人们谈论很多关于使用 jQuery 制作插件?难道它不应该是一个使您的网页更具交互性的 JavaScript 库吗?

回答by Tom Walters

jQuery is a JavaScript framework designed to allow developers to literally "write less, do more", the 3 different flavours you are asking about, do very different things.

jQuery 是一个 JavaScript 框架,旨在允许开发人员真正地“编写更少,做更多”,您正在询问的 3 种不同风格,做非常不同的事情。

First up jQuery is the core library which contains the main functionality of the framework, so if you want to make an element fade in, you would include jQuery on your page, and then call the fadeIn()function on one of your elements.

首先,jQuery 是包含框架主要功能的核心库,所以如果你想让一个元素淡入,你可以在你的页面上包含 jQuery,然后在你的fadeIn()一个元素上调用该函数。

jQuery UI was created with user-interface elements and interactions in mind that generally require a lot of code to manipulate otherwise. So the library contains things like the ability to drag and drop elements, and get useful information from those interactions. But at the same time there is a focus on the look and feel, therefore there are all sorts of themes available to style these powerful UI elements in this library.

jQuery UI 的创建考虑了用户界面元素和交互,否则通常需要大量代码进行操作。因此该库包含诸如拖放元素的能力以及从这些交互中获取有用信息的能力。但同时关注外观和感觉,因此有各种主题可用于在此库中设置这些强大的 UI 元素的样式。

jQuery mobile is a powerful framework built on top of jQuery and designed specifically for mobile platforms - after all the functionality of things like drag and drop needs to be rethought for touch screens, as does core functionality such as "hovering" which simply doesn't exist on mobile.

jQuery mobile 是一个强大的框架,构建在 jQuery 之上,专为移动平台而设计——毕竟拖放等功能需要为触摸屏重新考虑,核心功能如“悬停”也不需要存在于手机上。

All together the frameworks can be used to enhance the usability of a site, and really save developers a lot of time. To learn more about the framework visit Learning jQuery- a great resource for getting started.

所有这些框架都可以用来增强站点的可用性,真正为开发人员节省大量时间。要了解有关该框架的更多信息,请访问Learning jQuery- 一个很好的入门资源。

Plugins allow web developers to take the solution to their problem and abstract it into a single functional and independent block (usually in a separate file). They can then share that with everyone else so that they can do the same. So if someone builds a gallery feature for a site they made, making a plugin would allow them to easily reuse the code, and help others facing the same problem.

插件允许 Web 开发人员将解决方案用于他们的问题并将其抽象为单个功能和独立的块(通常在一个单独的文件中)。然后,他们可以与其他人分享,以便他们也可以这样做。因此,如果有人为他们制作的网站构建了图库功能,制作插件将使他们能够轻松重用代码,并帮助其他面临相同问题的人。