简体   繁体   English

jQuery Mobile还是响应式设计?

[英]Jquery Mobile or Responsive Design?

I've been doing a lot of research on building Responsive design. 我已经在构建响应式设计方面进行了大量研究。 So I came across this article from here: 因此,我从这里遇到了这篇文章:

Is it redundant using jQuery Mobile and a responsive layout /CSS media queries? 使用jQuery Mobile和响应式布局/ CSS媒体查询是否多余?

And it got me thinking. 这让我开始思考。 Won't Responsive Design replace making a Jquery Mobile website? 响应式设计不会取代制作Jquery Mobile网站吗? Because responsive design is the same thing JQ Mobile does but better because you have more control over each area. 因为响应式设计是同一件事,但JQ Mobile却更好,因为您可以更好地控制每个区域。 Correct me if I am wrong I was just wondering and learning! 如果我错了,请纠正我,我只是想知道和学习! So why would anyone want to use JQuery Mobile or even using JQ Mobile with a responsive design? 那么,为什么有人要使用JQuery Mobile甚至使用具有响应设计的JQ Mobile?

you probably won't use jquery mobile if you are supporting desktop screens too. 如果您也支持桌面屏幕,则可能不会使用jquery mobile。 Jquery mobile is more useful when it comes to mobiles and tablets. 当涉及到手机和平板电脑时,jQuery mobile更为有用。

Responsive design on the other hand enables you to display information on your website and keep it readable and usable irrespective of the screen size. 另一方面,响应式设计使您可以在网站上显示信息,无论屏幕大小如何,信息都保持可读性和可用性。 Refer Twitter Bootstrap if you want to support all the screen sizes. 如果要支持所有屏幕尺寸,请参考Twitter Bootstrap。

Update 更新资料

Normally you have different UI for desktop and mobile/tablets. 通常,您为台式机和手机/平板电脑使用不同的UI。 So based on the screen-size you can decide how each component(header, navbar, sidebar, body, footer) will be laid out on the viewport and how the design should be. 因此,根据屏幕大小,您可以决定如何在视口上布置每个组件(页眉,导航栏,边栏,正文,页脚)以及应如何设计。

For example your website will have a single column layout for mobiles and 2-column layout for tablets as against your desktop version. 例如,与您的台式机版本相比,您的网站的移动设备将具有单列布局,而平板电脑将具有2列布局。

The JQuery Mobile icons can be the size you want as long as it's 14px... jQuery Mobile图标可以是您想要的大小,只要14px ...

While this is not entirely true, you must have a very good understanding of how CSS is used in JQuery Mobile to change the size of icons, let alone change them in media queries. 尽管这并非完全正确,但您必须对如何在JQuery Mobile中使用CSS更改图标的大小有很好的了解,更不用说在媒体查询中更改图标了。

Buttons can have text and/or icons. 按钮可以具有文本和/或图标。 It would be nice to have buttons with both icon and text on a desktop PC, and only an icon on a mobile device. 最好在台式机上同时具有图标和文本按钮,而在移动设备上仅包含图标。 Well this seems to be even harder because the format of the button is specified by giving btn-* classes to the <button> (or <a>) element. 嗯,这似乎更加困难,因为通过将btn- *类赋予<button>(或<a>)元素来指定按钮的格式。 For instance: 例如:

<a href="#caddy" class="ui-btn ui-btn-icon-notext ui-corner-all ui-icon-caddy ui-nodisc-icon ui-alt-icon">Caddy</a>

or: 要么:

<a href="#order" class="ui-btn-a ui-corner-all ui-btn ui-btn-icon-right ui-icon-carat-r">Checkout</a>

So JQuery Mobile adds more constraints to what you can do with CSS, thus making it harder to build responsive interfaces. 因此,JQuery Mobile对您可以使用CSS进行的操作增加了更多约束,从而使构建响应式界面变得更加困难。

It's better to go with jQuery mobile if you are targeting mobile and handheld devices with smaller screens than a desktop. 如果您要针对屏幕比台式机小的屏幕的移动和手持设备,最好使用jQuery mobile。

The advantange with jQuery Mobile is that it provides you with some extra features like page events, page transitions, theming etc. It's easier ans simpler compared to writing code to perform all those manually. jQuery Mobile的优势在于它为您提供了一些额外的功能,例如页面事件,页面过渡,主题等。与编写代码手动执行所有操作相比,它更容易实现。

Also, jQuery Mobile uses more of a fluid layout which means your pages fit in most of the screen sizes. 同样,jQuery Mobile使用更多流畅的布局,这意味着您的页面适合大多数屏幕尺寸。 Where as responsive design lets you display/hide information based on the screen size. 作为响应式设计,您可以根据屏幕大小显示/隐藏信息。

If you are creating a responsive design web application, may I suggest you follow the Mobile-first approach which basically means you design and build your applications for mobile first instead of doing it after the PC version is done? 如果要创建响应式设计Web应用程序,我是否建议您遵循“ 移动优先”方法,该方法基本上意味着您首先为移动设备设计和构建应用程序,而不是在PC版本完成后进行设计?

Here's an example taken from the article: 这是本文中的一个示例:

 /*Large screen styles first - Avoid*/
.product-img {
  width: 50%;
  float: left;
}
@media screen and (max-width: 40.5em) {
  .product-img {
    width: auto;
    float: none;
  }
}
/* mobile first approach */
@media screen and (min-width: 40.5em) {
  .product-img {
    width: 50%;
    float: left;
  }
}

In that way, you may feel the jQuery mobile is redundant in your development process. 这样,您可能会觉得jQuery mobile在您的开发过程中是多余的。 Of couse, as others have mentioned, jQuery mobile comes in handy when you want to build a separate app for mobiles and tablets. 当然,就像其他人提到的那样,当您要为手机和平板电脑构建单独的应用程序时,jQuery mobile会派上用场。

如果要构建移动网站,则必须使用jQuery mobile,如果要支持桌面浏览器和移动浏览器,则必须使用引导程序或基础框架来制作响应式网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM