viewport

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

筅森魡賤 提交于 2019-11-29 01:50:55
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? Greg S 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. Things to do on window resize: Adjust viewport glViewport(0, 0, width, height) Adjust scissor

Does jQuery have any functions to scroll the client to the bottom of the view port?

左心房为你撑大大i 提交于 2019-11-29 00:29:55
问题 I want to animate a scroll to the bottom of the viewport with jQuery. Is there a plugin available which isn't overkill (i.e. without a huge feature set for this small task); Is there a plugin available or a way to do this natively with jQuery? 回答1: jQuery makes things like this so trivial that you just dont need a plugin. Example: var x = 250; //insert your own formula to calculate where you want to scroll to in px var t = 500; //arbitrary time in ms $("html,body").animate({ scrollTop: x }, t

PDF转图片,在线PDF转JPG/PNG

随声附和 提交于 2019-11-28 23:58:28
[在线DEMO]( https://oktools.net/pdf2img ) 原理 使用pdf.js预览图片,pdf.js将pdf通过canvas将每一页渲染出来,然后我们通过canvas的toDataURL方法保存为jpg或png格式。 pdf.js是Mozilla开源的一个js库,无需任何本地支持就可以在浏览器上显示pdf文档。唯一的要求就是浏览器必须支持HTML5。 依赖 需要 pdf.min.js 和 pdf.worker.min.js 两个js文件 全部代码实现 pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdn.bootcss.com/pdf.js/2.2.228/pdf.worker.min.js'; const preview = document.getElementById('preview'); const page_num = document.getElementById('page_num'); const out_type = document.getElementById('out_type'); let pdfFile, pdf, pageNum, context = preview.getContext('2d'); out_type.querySelectorAll('.button')

Scroll if element is not visible

偶尔善良 提交于 2019-11-28 23:07:20
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. 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 - $(window).scrollTop(); if(offset > window.innerHeight){ // Not in view so scroll to it $('html,body').animate(

How to check if css value is supported by the browser?

十年热恋 提交于 2019-11-28 21:15:24
Im not very skilled in javascript so please be bear with me. Safari 6 and below and older android mobile browsers and maybe more do not support the css value VH. My DIV#id or class is not the height of the viewport. Below is a link to a page i found some useful information, but im really not sure how to use it with a css value: Check whether a css value is supported Here is the code given as a shortcut for you: if('opacity' in document.body.style) { // do stuff } function isPropertySupported(property{ return property in document.body.style; } In the comments of the link i attached above

click事件300 毫秒点击延迟的来龙去脉

南笙酒味 提交于 2019-11-28 21:09:03
原文地址: What Exactly Is..... The 300ms Click Delay 快速响应是所有 UI 实现的重中之重。研究表明,当 延迟超过 100 毫秒 ,用户就能感受到界面的卡顿。 然而,出于对手指触摸滑动的区分,移动端页面对于触摸事件会有 300 毫秒的延迟,导致多数用户感觉移动设备上基于 HTML 的 web 应用界面响应速度慢。 本文主要讨论上述延时的来历,浏览器生产商的考虑,以及我们作为开发者,当前应该如何处理这个问题。 300 毫秒延迟的来历 这要追溯至 2007 年初。苹果公司在发布首款 iPhone 前夕,遇到一个问题 —— 当时的网站都是为大屏幕设备所设计的。于是苹果的工程师们做了一些约定,应对 iPhone 这种小屏幕浏览 桌面端 站点的问题。 这当中最出名的,当属双击缩放(double tap to zoom)。这也是会有上述 300 毫秒延迟的主要原因。 双击缩放 双击缩放,顾名思义,即用手指在屏幕上快速点击两次,iOS 自带的 Safari 浏览器会将网页缩放至原始比例。 下面以这篇 网站响应时间的文章 页面为例,刚一打开页面,除了文章本身,我们还看到顶部通栏、菜单等非关键性要素。 我们进入这个页面的目的显然是为了阅读这篇文章。所以当我们双击屏幕时,Safari 会相当智能地缩放至主体文章。 上述例子表明,iOS Safari 在双击后

osgViewer

回眸只為那壹抹淺笑 提交于 2019-11-28 20:17:16
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for

移动端适配方案 viewport

只谈情不闲聊 提交于 2019-11-28 20:10:25
背景 今年3月份的时候新入职了一家公司有需求要做自己公司APP上面的小程序。就是类似于微信小程序那种结构。 其中有遇到了一个问题,就是移动端的适配问题,之前我一直用的rem的适配方案( 不知道的可以点这里 ),也没有什么太大的问题。但是又想着都 9102 了会不会有点捞~于是就找找看看有没有更好的替代方案(结合时代的)。 响应式 Web 设计 - Viewport 什么是 Viewport ? viewport是用户网页的可是区域。翻译中文就是“视区”,手机浏览器是把页面放在一个虚拟的"窗口"(viewport)中,通常这个虚拟的"窗口"(viewport)比屏幕宽,这样就不用把每个网页挤到很小的窗口中(这样会破坏没有针对手机浏览器优化的网页的布局),用户可以通过平移和缩放来看网页的不同部分。 关于 Viewport 的三个理论 来自于 PPK(Peter-Paul Koch) 关于 viewport 的三个观点( so~1 , so~2 , so~3 ),有很多文章的观点都出自那里(包括本文)。 layout viewport (布局视区):在移动端浏览器上面,视觉视区限制了布局视区,为了能在移动设备上正常显示那些为pc端浏览器设计的网站,移动设备上的浏览器都会把自己默认的 viewport 设为980px或其他值,一般都比移动端浏览器可视区域大很多

Mobile Safari Viewport - Preventing Horizontal Scrolling?

自作多情 提交于 2019-11-28 18:42:53
I'm trying to configure a viewport for mobile Safari. Using the viewport meta tag, I am trying to ensure that there's no zooming, and that you can't scroll the view horizontally. This is the meta tag I'm using: <meta id="viewport" name="viewport" content ="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> On my iPhone when I load the page, it seems to look okay: But I can scroll horizontally, so that it looks like this (this is as far to the right as I can go: When I swing it into landscape view, the page renders as expected, locking the horizontal scroll position.

How is the meta viewport tag used, and what does it do?

橙三吉。 提交于 2019-11-28 18:42:05
What browsers support this meta tag? How do i use it? Does this mean it will solve all my mobile resizing problems? If anyone could answer this it would be a great help to newbies learning <meta="viewport"> The viewport browser support is a little bit across the board. I'll point you to the Quirksmode page for viewport browser support for the full details. You use the viewport meta tag like any other meta tag. Put the code block straight up in the <head> . Pretty much, but again, a little bit of a mouthful to say here. I'd advise reading some articles , reading the W3 mobile best practices for