jQuery 将网站转换为移动网站
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12688084/
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
Convert a website to a mobile website
提问by Michael Schmidt
I just finished my website. And when i visit the site with a desktop browser, it looks nice. But when i visit the site with a mobile device, the site is illegible...
我刚刚完成了我的网站。当我使用桌面浏览器访问该站点时,它看起来不错。但是当我使用移动设备访问该网站时,该网站难以辨认...
So i want a mobile version of my website. But i don't want to study mobile web developing just for one site... so it must be easy for a layman like me!
所以我想要我的网站的移动版本。但我不想只为一个网站学习移动网络开发......所以对于像我这样的外行来说,这一定很容易!
i search allready in google, but only found some tutorials. and these tutorials are really hard for me... i search something like a tool or a team who convert it for me. i also pay something for it!
我已经在谷歌搜索了,但只找到了一些教程。这些教程对我来说真的很难......我会搜索一些工具或团队来为我转换。我也为此付出了代价!
thank you for answering
谢谢你的回答
回答by Christopher
What you can do is, use javascript or css to detect the width of the screen.
您可以做的是,使用 javascript 或 css 来检测屏幕的宽度。
Then with the detected results you use either your Desktop CSS or Mobile CSS. That'll be the quickest way, obviously you will need to create a seperate CSS file for mobile and construct it for mobile.
然后根据检测到的结果,您可以使用桌面 CSS 或移动 CSS。这将是最快的方法,显然您需要为移动设备创建一个单独的 CSS 文件并为移动设备构建它。
Here's how you can detect:
以下是您可以检测的方法:
<link rel="stylesheet" media="only screen and (max-width: 600px)" href="mobile.css" />
<link rel="stylesheet" media="only screen and (min-width: 601px)" href="desktop.css" />
回答by Michael Schmidt
When I start to develop websites, I just develop websites for big screens. But in these times with so many mobile devices, you must be able to develop mobile websites as a web developer.
当我开始开发网站时,我只是为大屏幕开发网站。但在当今移动设备众多的时代,您必须能够以 Web 开发人员的身份开发移动网站。
Of much help to me was the website http://www.dudamobile.com/index.php. It converts your website to a mobile view. Not perfect, but a very good basis. For free.
对我帮助很大的是网站http://www.dudamobile.com/index.php。它将您的网站转换为移动视图。不完美,但基础很好。免费。
When you are inexperienced with mobile developing, google for tips.
如果您对移动开发缺乏经验,请谷歌搜索提示。
http://jquerymobile.com/has some information for the mobile version of jQuery. Or just ask on Stack Overflow.
http://jquerymobile.com/有一些关于移动版 jQuery 的信息。或者直接问 Stack Overflow。