viewport

移动前端知识总结

橙三吉。 提交于 2019-11-28 13:15:30
移动前端知识总结 文章目录 meta基础知识 常见问题 常用的移动端框架 iscroll.js underscore.js 滑屏框架 FastClick meta基础知识 H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 <meta name = "viewport" content = "width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 忽略将页面中的数字识别为电话号码 <meta name = "format-detection" content = "telephone=no" /> 忽略 Android 平台中对邮箱地址的识别 <meta name = "format-detection" content = "email=no" /> 当网站添加到主屏幕快速启动方式,可隐藏地址栏,仅针对 ios 的safari <meta name = "apple-mobile-web-app-capable" content = "yes" /> <!-- ios7.0版本以后,safari上已看不到效果 --> 将网站添加到主屏幕快速启动方式,仅针对ios的safari顶端状态条的样式 <meta name = "apple-mobile

How to increase the vertical split window size in Vim

淺唱寂寞╮ 提交于 2019-11-28 13:08:51
问题 :vsplit (short form: :vs ) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to 31 or 29? With horizontal windows Ctrl - W + increases the number of lines by one. What is the equivalent command to increase the columns by one? 回答1: CTRL - W > and CTRL - W < to make the window wider or narrower. 回答2: And Ctr - W = will make them equal 回答3: In case you need HORIZONTAL SPLIT

再聊移动端页面的适配

岁酱吖の 提交于 2019-11-28 10:56:06
再聊移动端页面的适配 前端圈真乱,这话一点不假。但乱也乱的好处,乱则生变,有变化才有进步。今天还是老调重谈,聊聊移动端页面的适配。因为对于一枚前端而言,天天和页面打交道(H5页面),那么布局的活总是少不了,这也将面临不同终端的适配问题。不知道你是否和我一样,页面布局总是或多或少会有一些蛋疼的事情发生。如果是的话,建议你花点时间阅读完下面我扯蛋的东东。 Flexible承载的使命 Flexible到今天也有几年的历史了,解救了很多同学针对于H5页面布局的适配问题。而这套方案也相对而言是一个较为成熟的方案。简单的回忆一下,当初为了能让页面更好的适配各种不同的终端,通过Hack手段来根据设备的 dpr 值相应改变 <meta> 标签中 viewport 的值: 从而让页面达么缩放的效果,也变相的实现页面的适配功能。而其主要的思想有三点: 根据 dpr 的值来修改 viewport 实现 1px 的线 根据 dpr 的值来修改 html 的 font-size ,从而使用 rem 实现等比缩放 使用Hack手段用 rem 模拟 vw 特性 有关于Flexible方案实现适配,在2015年双十一之后做过这方面的技术文档分享,感兴趣的同学可以移步阅读《使用Flexible实现手淘H5页面的终端适配》一文。虽然Flexible解决了适配终端很多问题,但它并不是万能的,也不是最优秀的

The values of meta viewport attribute are not reflected when in full screen mode in android chrome browser

南楼画角 提交于 2019-11-28 10:37:54
When I am in full screen mode in android using fullscreen api, the values of meta viewport attribute like initial-scale and user-scalable are not reflected in the browser. If I am not in full screen mode, the values of meta viewport are reflected. You can check it by accessing MDN:Fullscreen api example from a mobile browser I don’t find any source saying meta viewport will be disabled in fullscreen in android. So am I making any mistake or no one has documented it? Also pinch and zoom is disabled when in fullscreen Raised a issue in https://github.com/whatwg/fullscreen/issues/111 but no luck.

To “user-scalable=no” or not to “user-scalable=no”

懵懂的女人 提交于 2019-11-28 10:17:55
I've read different threads but never got to a clear conclusion, what are the differences, advantages and disadvantages of using user-scalable=no on case A or case B? I'm going to do a responsive website, which case is better then? CASE A: <meta name="viewport" content="width=device-width, user-scalable=no"> CASE B: <meta name="viewport" content="width=device-width"> You don't need to use user-scalable=no for responsive web design. You use it if you want your web app to feel more like a native app (in terms of zooming). You can control that users wont break your design if they zoom in. But

How to set viewport dynamically?

天大地大妈咪最大 提交于 2019-11-28 09:31:33
If I want to change the viewport tag dynamically, what do I need to do? For Mobile <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> iPad (width over 768px) <meta name="viewport" content="width=device-width, initial-scale=0.7, maximum-scale=2, user-scalable=yes" /> For sample : <meta name="viewport" content="width = 384" id="myViewport"> It sets the layout viewport width to 384 pixels. This works in most modern browsers; Nokia WebKit being the prime exception. You might want to give the layout viewport a width of 380px unless you’re on a

Animate counter when in viewport

筅森魡賤 提交于 2019-11-28 09:06:37
I have a counter which animates to a final number which is defined in the HTML. However I would like this animation to happen once it's in the viewport. I have a fiddle here which shows how scrolling seems to effect the counter number. $(document).ready(function() { $(function($, win) { $.fn.inViewport = function(cb) { return this.each(function(i, el) { function visPx() { var H = $(this).height(), r = el.getBoundingClientRect(), t = r.top, b = r.bottom; return cb.call(el, Math.max(0, t > 0 ? H - t : (b < H ? b : H))); } visPx(); $(win).on("resize scroll", visPx); }); }; }(jQuery, window)); $("

How to enable user-scalable (viewport property) after disabling it?

旧时模样 提交于 2019-11-28 08:51:05
问题 I created an Android app with Phonegap. I want to be able to have a fixed div in one page and to zoom-in in another page. I use jquery mobile 1.2.0, Jquery 1.8.2, Phonegap 2.0.0 and Android 2.2. My code is: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My Phonegap Application</title> <link rel="stylesheet" href="./lib/jquery.mobile-1.2.0.css" /> <script src="./lib/jquery-1.8.2.js"></script> <script src="./lib/jquery.mobile-1.2.0.js"></script> <script src="./lib/cordova-2.0.0.js"

How to zoom in to JPanel without moving the center: math or Swing?

北慕城南 提交于 2019-11-28 08:48:20
I am trying to make a zoomable map with Swing. The map is a JPanel in a JScrollPane. When zoomed in, the map changes size and paint() paints the elements in a different position. This all works great. However, the ScrollPane didn't change the viewport while increasing the image size, so that zooming in always moved the elements I was looking at out of the screen. I tried to solve this with scrollRectToVisible() , but I don't manage to get the right coordinates for the rectangle, either because I fail at doing the geometry or because I don't understand Swing all that well. Here is what I have:

Webpage starts zoomed in on mobile devices

荒凉一梦 提交于 2019-11-28 08:02:14
I'm using this code on my webpage <meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0"> I would think the initial scale would make sure the webpage was zoomed out, but it doesn't. Any ideas? I've tried this: <meta name="viewport" content="width=device-width, initial-scale=1.0"/> But, I need the width to be set to 1000px or it doesn't look correct. Answer: <meta name="viewport" content="width=1000; user-scalable=0;" /> initial-scale=1.0 tells the browser to set the zoom level to normal (i.e. not zoomed in or out). You only need width=1000 : <meta name="viewport"