viewport

Get div to show/hide when scrolling for a “back to top” link

血红的双手。 提交于 2019-12-03 16:17:09
I can't make my "go to top" id=arrow-up div to disappear when on e.g. top of the page. At the top of the page I got So I would like the arrow-up div to visible(show("slow")) when not on top of the page. var tmp = $(window).height(); Tmp is used to get the viewport height... Not sure if that is right? I have seen other solutions but they are only kind of the same... and I can't make them work, also they font use :in-viewport . Can I make it with viewport or am I side tracked? <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"> </script> <script src="bootstrap-3.1.1

「前端」rem 缩放方案 flexible-js 兼容 375px 方案的思路

▼魔方 西西 提交于 2019-12-03 15:05:41
本文来自尚妆前端团队 南洋 发表于 尚妆github博客 ,欢迎订阅。 移动端H5页面rem缩放方案flexible.js兼容375px方案的思路 参考: 移动端高清、多屏适配方案 viewport-and-flexible.js flexible.js github 一个新的项目复用了一些老页面,老页面是使用375px方案进行移动端适配的,meta[viewport]使用的是 <meta name="viewport" content="width=375, user-scalabe=no"> ,而新页面使用的是flexible.js伸缩方案,动态生成meta[viewport] <meta name="viewport" content="initial-scale=[num], user-scalabe=no"> 如何在老页面使用px布局的前提下,新页面使用rem布局,组件也使用rem布局,并且组件可以兼容老页面和新页面是本文的结果。 首先会介绍375px方案和rem方案的实现原理。 375px方案 <meta name="viewport" content="width=375, user-scalabe=no"> 375px方案的页面开发过程对新人非常的友好,利用页面的布局视口(layout viewport)为固定值375px,和移动端浏览器窗口的自动缩放功能(视觉视口

WKWebView viewport shrink-to-fit not working on iOS 9.3

谁说胖子不能爱 提交于 2019-12-03 13:55:56
In iOS 9.2, a WKWebView rendering HTML with fixed-width tables bigger than the device width could be told to shrink the content to fit by adding a viewport tag like this: <meta name="viewport" content="width=device-width, shrink-to-fit=YES"> This line caused the WKWebView to effectively zoom out the viewport so that the entire rendered page fit in the view frame without the need for scrollbars. For example, consider the following code, when run in viewDidLoad in a vanilla single view app: WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; WKWebView *newWebView = [

浅谈响应式Web设计与实现思路

社会主义新天地 提交于 2019-12-03 13:08:37
是否还在为你的应用程序适配PC端,移动端,平板而苦苦思索呢,是否在寻找如何一套代码适配多终端方式呢,是否希望快速上手实现你的跨终端应用程序呢,是的话,那就看过来吧,本文阐述响应式UI设计相关理论基础,包括:屏幕尺寸,物理,设备独立,CSS像素,dpr,视口等相关概念,还有响应式设计基础,常见设计模式,及响应式UI实现基本思路,希望能加深对响应式的理解和实践思路。 欢迎访问我的个人博客 响应式(Responsive) 响应式是什么呢?顾名思义,响应式,肯定会自动响应,响应什么?应用程序是在终端屏幕窗口中展示给用户,被用户访问的,那么就是响应屏幕的变化,不同终端屏幕尺寸大小不一致,需要针对不同尺寸屏幕进行不同的展示响应。 响应式(Responsive web design, RWD) ,是指一套应用程序用户界面(User Interface)能自动响应不同设备窗口或屏幕尺寸(screen size)并且内容,布局渲染表现良好。 自适应(Adaptive) 在响应式设计(RWD)之外,还有一种适配多设备屏幕的方式, 自适应设计(Adaptive web design, AWD) 。 自适应设计(AWD),是指一个应用程序使用多版本用户界面,针对不同设备屏幕,服务器端返回不同版本用户界面,供用户访问。 自适应vs响应式 自适应和响应式设计的不同主要概括如下: 自适应是多套用户界面

Issue with iOS 11 full screen web app on iPad and the status bar

橙三吉。 提交于 2019-12-03 13:01:45
问题 I have a full screen home screen web app that is designed for 1024x768 resolution so it fits perfectly on the iPad in landscape mode. Or at least, it did, until the iOS 11. This update now has content rendered under the status bar which pushed the entire page down 20 pixels. My meta-tags involved are as follows: <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="initial-scale=1

Webgl gl.viewport change

大憨熊 提交于 2019-12-03 12:25:55
I have a problem with canvas resizing and gl.viewport sync. Let's say that I start with both the canvas 300x300 canvas , and the initialization of gl.viewport at the same sizes ( gl.vieport(0, 0, 300, 300) ). After that, in browser's console I make my tests: I'm changing size of my canvas , using jquery, calling something like $("#scene").width(200).height(200) After this, i'm calling my resizeWindow function : function resizeWindow(width, height){ var ww = width === undefined? w.gl.viewportWidth : width; var h = height === undefined? w.gl.viewportHeight : height; h = h <= 0? 1 : h; w.gl

iOS / mobile safari still zooms while viewport is set to user-scalable=no ? Check Accessibility settings!

拟墨画扇 提交于 2019-12-03 11:36:16
问题 This specific Mobile Safari (seemingly impossible and yet undocumented) problem kept me going for a long long time today, and I was just about to post a question about it here when I figured it out. The problem: While I had set <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no;"/> my iPad web-app still allowed manual zooming (pinching in the browser). -- But only on my iPad, not on my iPhone. Also I would rotate the

Find screen position of a QGraphicsItem

感情迁移 提交于 2019-12-03 11:27:09
Use case: This should be a fairly common problem. In a normal QMainWindow with QMdiArea lives an mdiChild with a QGraphicsView. This view displays a QGraphicsScene with QGraphicsItems inside. A right-click at one of these items selects (focusses) the item and opens a context menu, which is conveniently placed at the screen coordinates QGraphicsSceneMouseEvent::screenPos() . This is working as expected. Now I'd like to show the same context menu when the user presses a key (e.g. Qt::Key_Menu). I know the selected (focussed) item, I know the view which displays the scene. So my question is: What

How use JQuery/Javascript to scroll down a page when the cursor at the top or bottom edge of the screen?

末鹿安然 提交于 2019-12-03 10:40:42
Simple, I just would like to have it so when a user is dragging an item and they reach the very bottom or top of the viewport (10px or so) , the page (about 3000px long) gently scrolls down or up, until they move their cursor (and thus the item being dragged) out of the region . An item is an li tag which uses jquery to make the list items draggable. To be specific: ../jquery-ui-1.8.14.custom.min.js http://code.jquery.com/jquery-1.6.2.min.js I currently use window.scrollBy(x=0,y=3) to scroll the page and have the variables of: e.pageY ... provides absolute Y-coordinates of cursor on page (not

移动端页面适配———多方案解析

久未见 提交于 2019-12-03 10:28:07
移动端页面适配———多方案解析 在移动互联网快速发展的今天,手机的种类和尺寸越来越多,作为前端的小伙伴们可能会越来越头疼,但又不得不去适配一款又一款的新机型。对于移动端适配,不同的公司、不同的团队有不同的解决方案。我在项目中也用了一部分解决方案,也看到了一些解决方案,对比下,总结一些自己的理解,希望对各位有帮助,找到最适合你们项目的适配方案。 下面是一些基础概念的讲解,帮助理解各种适配方案实现。 像素: 1、物理像素(设备像素) 屏幕的物理像素,又被称为设备像素,他是显示设备中一个最微小的物理部件。任何设备屏幕的物理像素出厂时就确定了,且固定不变的。 2、设备独立像素 设备独立像素也称为密度无关像素,可以认为是计算机坐标系统中的一个点,这个点代表一个可以由程序使用的虚拟像素(比如说CSS像素),然后由相关系统转换为物理像素。 3、设备像素比 设备像素比简称为dpr,其定义了物理像素和设备独立像素的对应关系 设备像素比 = 物理像素 / 设备独立像素 以iphone6为例: iphone6的设备宽和高为375pt * 667pt,可以理解为设备的独立像素,而其设备像素比为2.固有设备像素为750pt * 1334pt 通过:window.devicePixelRatio获得。 设备像素比是区别是否是高清屏的标准,dpr大于1时就为高清屏,一般情况下dpr为整数