viewport

移动端页面开发流程

只愿长相守 提交于 2019-11-27 23:40:09
移动端页面布局 一、移动端app分类 1、Native App原生app手机应用程序    使用原生的语言开发的手机应用,Android系统用的是java,ios系统用的是object-C 2、Hybrid App 混合型app手机应用程序    混合使用原生的程序和html5页面开发的手机应用 3、Web App 基于Web的app手机应用程序    完全使用html5页面加前端js框架开发的手机应用 二、Viewport视口   视口是移动设备上用来显示网页的区域,一般会比移动设备可视区域大,宽度可能是980px或者1024px,目的是为了显示下整个为PC端设计的网页,这样带来的后果是移动端会出现横向滚动条,为了避免这种情况,移动端会将视口缩放到移动端窗口的大小。这样会让网页不容易观看,可以用meta标签,name="viewport"来设置视口的大小,将视口的大小设置为和移动设备可视区一样的大小。   在移动端用来承载网页的这个区域,就是我们的视觉窗口,viewport(视口),这个区域可以设置高度宽度,可以按比例放大缩小,而且能设置是否允许用户自行缩放。 参数说明: width:宽度设置的是viewport宽度,可以设置device-width特殊值initial-scale:初始缩放比,大于0的数字maximum-scale:最大缩放比minimum-scale

In OpenGL, how can I adjust for the window being resized?

你说的曾经没有我的故事 提交于 2019-11-27 21:47:56
问题 I am drawing several shapes (such as circles) that are keyed off of the window height & width. Since the window always starts at a given size, they are drawn correctly, but when the window is resized, it messes the aspect ratio up. How can I draw the shapes properly, regardless of window size? 回答1: You definitely don't want to make the size of your objects explicitly dependent on the window size. As already suggested by genpfault, adjust your projection matrix whenever the window size changes

Android viewport setting “user-scalable=no” breaks width / zoom level of viewport

我怕爱的太早我们不能终老 提交于 2019-11-27 17:53:54
I am working on a web app which has a width of 640px. In the document head I set <meta name="viewport" content = "width=640, user-scalable=no" /> so the content is nicely displayed and stretched horizontally. This works perfectly on iOS but in Android the browser opens the website zoomed in so the user has to double click to zoom out and the entire page. When I change the viewport setting to leave out the user-scalable tag like this: <meta name="viewport" content="width=640" /> the Android browser adjusts nicely to the 640px - so it works. The problem however now is, that users can zoom in and

What are the device-width css viewport sizes of the iPhone6 and iPhone 6 Plus

*爱你&永不变心* 提交于 2019-11-27 17:52:16
The iPhone 6 and iPhone 6 Plus were just announced. But as usual, phone specs never give the meta viewport device-width sizes in CSS Pixels or DPR at width=device-width,initial-scale=1 . Predictions have been made, speculating on 375/414px viewport width, but that still remains unclear... NB: Please don't speculate or post answers with the known overall device resolution or specs, it's not what I am looking for. I want the default responsive portrait and landscape viewport-width in pixels. (css) device-width of iPhone 6 is 375px , of iPhone 6 Plus is 414px . Note that iPhone 6 Plus report

What is viewport in HTML.

荒凉一梦 提交于 2019-11-27 17:29:35
What is viewport in HTML? Could you give some examples on how to access the viewport details? Matchu The viewport is the part of the webpage that the user can currently see. The scrollbars move the viewport to show other parts of the page. Follow this article's instructions to get the viewport dimensions in Javascript . if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight } Joe.wang I think the ViewPort is just an area to display the web content in the browser. And different browsers have their own setting for the size of

Viewport meta tag for iOS devices

我的梦境 提交于 2019-11-27 17:24:30
问题 Does stating <meta name="viewport" content="width=device-width" /> have the same effect as stating <meta name="viewport" content="width=768" /> for the ipad? 回答1: It depends indeed on the orientation of the device: setting a specific pixel value will cause your layout to be scaled up with a factor of 1.333 to fit inside the 1024px device width when in landscape mode. Setting width=device-width on the other hand will not scale anything up, but change the viewport width, for which you then can

What's the point of 'meta viewport user-scalable=no' in the Google Maps API

痞子三分冷 提交于 2019-11-27 17:19:20
I'm using the Google Maps JavaScript API V3 and the official examples always have you include this meta tag: <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> Most of the 3rd-party examples I've seen also do it. I wrote a plugin using it, though, and one of my users told me it's preventing him from being able to zoom in and out on his mobile device . I don't have a mobile device to test with, and none of my searches revealed any helpful information. So, what's the point of the tag? Should I leave it in? Should I try to detect the browser agent and only show it for desktop

jquery $(window).width() and $(window).height() return different values when viewport has not been resized

99封情书 提交于 2019-11-27 17:04:12
I am writing a site using jquery that repeatedly calls $(window).width() and $(window).height() to position and size elements based on the viewport size. In troubleshooting I discovered that I am getting slightly different viewport size reports in repeated calls to the above jquery functions when the viewport is not resized. Wondering if there is any special case anyone knows of when this happens, or if this is just the way it is. The difference in sizes reported are 20px or less, it appears. It happens in Safari 4.0.4, Firefox 3.6.2 and Chrome 5.0.342.7 beta on Mac OS X 10.6.2. I didn't test

Scroll if element is not visible

这一生的挚爱 提交于 2019-11-27 14:33:14
问题 how to determine, using jquery, if the element is visible on the current page view. I'd like to add a comment functionality, which works like in facebook, where you only scroll to element if it's not currently visible. By visible, I mean that it is not in the current page view, but you can scroll to the element. 回答1: Live Demo Basically you just check the position of the element to see if its within the windows viewport. function checkIfInView(element){ var offset = element.offset().top - $

svg的viewport和viewbox

走远了吗. 提交于 2019-11-27 13:02:21
svg中视区重要的概念 1. viewport 视口,相当于显示器屏幕 2. viewbox 视区,相当于在屏幕上截取一小块,放大到整个屏幕,就是特写的效果 3. preserveAspectRatio 规定viewbox与viewport的对齐方式和缩放方式 viewBox的显示效果正如下图: SVG就像是我们的显示器屏幕,viewBox就是截屏工具选中的那个框框,最终的呈现就是把框框中的截屏内容再次在显示器中全屏显示。 viewBox的width\height越小,viewBox的效果越明显。好比我们截屏工具选中区域越小,后来截屏内容铺满屏幕时反差越大。 如果是极端情况,设置viewBox的width/height的大小和viewpoint也就是svg的width\height一样大小,那么即使使用了viewBox,也不会改变原有的效果。 它和没有给svg使用viewBox时的情况是一样的。这和你把一个满屏截图铺满屏幕显示是一样的原理,感受不到缩放。 出处:https://www.oxxostudio.tw/articles/201409/svg-23-viewpoint-viewBox.html https://my.oschina.net/710409599/blog/307658 来源: https://www.cnblogs.com/mengff/p/11364346