viewport

Can I change the viewport meta tag in mobile safari on the fly?

≯℡__Kan透↙ 提交于 2019-11-30 06:58:24
I have an AJAX app built for mobile Safari browser that needs to display different types of content. For some content, I need user-scalable=1 and for other ones, I need user-scalable=0 . Is there a way to modify the value of the content attribute without refreshing the page? <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> I realize this is a little old, but, yes it can be done. Some javascript to get you started: viewport = document.querySelector("meta[name=viewport]"); viewport.setAttribute('content', 'width=device-width, initial

R adding a datatable to a ggplot graph using viewPorts : Scaling the Grob

本小妞迷上赌 提交于 2019-11-30 06:52:01
I'm trying to add a data-table to a graph made in ggplot (similar to the excel functionality but with the flexibility to change the axis its on) I've had a few goes at it and keep hitting a problem with scaling so attempt 1) was library(grid) library(gridExtra) library(ggplot2) xta=data.frame(f=rnorm(37,mean=400,sd=50)) xta$n=0 for(i in 1:37){xta$n[i]<-paste(sample(letters,4),collapse='')} xta$c=0 for(i in 1:37){xta$c[i]<-sample((1:6),1)} rect=data.frame(xmi=seq(0.5,36.5,1),xma=seq(1.5,37.5,1),ymi=0,yma=10) xta=cbind(xta,rect) a = ggplot(data=xta,aes(x=n,y=f,fill=c)) + geom_bar(stat='identity'

How can I force a site to scale to fix for mobile (Iphone android..)

﹥>﹥吖頭↗ 提交于 2019-11-30 06:16:20
问题 When I load my site in an iphone it doesn't scale down. All I see is the top-left most couple hundred sqare pixels. I am new to mobile optimization, but I feel like most pages scroll to fit automatically, and most questions seem to be for the opposite scenario that I am having (force phone not to scale down). I would want the whole page width to be visable and to make it so the user would have to zoom in to read the text. I have tried with and without the following code in the head, but with

移动端布局方案,简单高效,完美适配各种机型

本秂侑毒 提交于 2019-11-30 05:49:11
第一步:使用淘宝的lib/flexible+rem布局 原理:    rem布局: 使用rem作为元素大小的单位,rem=fount-size,根据不同的屏幕宽度设置不同的fount-size值,这样元素也会跟着屏幕变大或变小    lib/flexible:     通过js查询屏幕大小,设置viewport标签的同时始终将fount-size设置为屏幕宽度的1/10。     我们也应该将设计稿分成1/10与之对相应,     由此得到1rem=屏幕宽度的1/10=设计稿的1/10     如果设计稿大小为750px,则1rem=75px,     比如在设计稿上量到一个宽度为150的元素,可以通过150/75得到此元素在设备中的宽度为2rem 用法:    去掉html中的viewport标签,vue项目在public/index.html中操作     vue项目中在main.js中引入flexible    import ' lib/flexible/flexible.js ' 引入后就实现了动态设置fount-size和viewport标签了,接下来我们只要在项目中以rem为单位写样式就可以了,但是 每次都要手动计算rem太麻烦,可以使用插件postcss-px2rem-exclude 第二步:使用postcss-px2rem-exclude将px转换为rem    

How to reset viewport scaling without full page refresh?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 05:38:57
问题 I have a web-page that has the "user-scalable" attribute of the viewport meta tag set to true (Safari reference, Android reference). So users with browsers that recognize the attribute (such as Mobile Safari, Android Browser) can pinch to scale the page. However, there is a link that refreshes most of the page using AJAX, but does not perform a full page refresh. I'd like to reset the viewport scaling to the initial value using JavaScript. But I can't figure out how to do this. The only

Viewport units, keeping aspect ratio?

一世执手 提交于 2019-11-30 05:25:46
So I've just discovered viewport units, and I really want to use them. First challenge: My element has a "base size" of 760x670 pixels. I want to use viewport units to scale it up so that either the height is 100vh , or the width is 100vw , whichever is smaller. Unfortnately, although I can use 100vmin to get the smaller of the two, I can only apply it to the width or the height, not both. Currently I'm using: #root { width: 760px; height: 670px; width: 100vw; height: calc(670vw/760); } This scales the width to fit the screen, resulting in vertical scrolling. This isn't too bad, but I'd prefer

Viewport Tag Syntax

戏子无情 提交于 2019-11-30 04:04:33
问题 I have been looking on the web and I'm still confused on which works and does not. I see errors on chrome when I use the semi-colon, but the iPhone recognizes it. The comma works also without errors. I'm wondering which one is qualified as the correct way of writing it. Semi Colons - <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" /> Commas - <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user

Why is the viewport tag on the Galaxy Nexus / Android 4 not working?

Deadly 提交于 2019-11-30 03:40:00
I'm working on a webApp that should resize to any screen size a device could have. On iOS and older android versions the viewport tag works fine. The picture on the screen is always resized to fit the screen. (Like described here: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html#//apple_ref/doc/uid/TP40006509-SW19 ) On the Galaxy Nexus (Android 4.0) it won't work. On the left and right side is about 20px space and I don't know why he does this. My viewport tag looks like this: <meta name="viewport"

Detect when elements within a scrollable div are out of view

…衆ロ難τιáo~ 提交于 2019-11-30 03:24:19
I need to find a good solution to the following problem. I see a lot of people asking about tracking if an element is in or outside of view Port for the page or browser window. I need to be able to replicate this action, but inside a DIV that scrolls, with overflow:scroll for example. Does anyone know of a good example, for this specific action? Thanks in advance. i had the same problem before, i have ended up with the following function.the first parameter is for the element to check, the second is to check if the element is partially in-view.it is for vertical check only, you can extend it

浅谈前端移动端页面开发(布局篇)

感情迁移 提交于 2019-11-30 00:32:31
前言的一些碎碎念:最近一直在写移动端的页面,不过一直是用的别人造好的轮子,很多时候并没有想那是为什么,那是怎么样要那么写,就跟着别人的文档去了。本以为自己对移动端的那一丢丢理解,结果很多东西都特么有问题,所以,今天停下了手中的一些东西,来谈下移动端的布局方案吧 一. viewport 什么是viewport 简单来讲,viewport就是浏览器上,用来显示网页的那一部分区域了,也就是说,浏览器的实际宽度,是和我们手机的宽度不一样的,无论你的手机宽度是320px,还是640px,在手机浏览器内部的宽度,始终会是浏览器本身的viewport。如今的浏览器,都会给自己的本身提供一个viewport的默认值,可能是980px,或者是其他值。就以手机来说吧,目前,新版本的手机浏览器,绝大部分是以980px作为默认的viewport值的。我这里对新版本的不同平台下的浏览器做了测试,经过测试,iphone下的默认viewport为980px,安卓下的浏览器,目前主流的最新浏览器(比如chrome,还有很多国产的像qq,uc)的viewport也是980px了。 viewport是用来干什么的 viewport的默认值,一般来说是大于手机屏幕的。这样就可以做到当我们在浏览桌面端网页的时候,可以让桌面端端网页正常显示(我们普通页面设计的时候,一般页面的主区域是以960px来做的,所以980px这个值