简体   繁体   English

Webapp运动

[英]webapp movement

i have created a webapp using only html css javascript using iui library i have few pages and all the content is inside one html page and for page navigation and slide effect i have used iui framework 我使用iui库仅使用html css javascript创建了一个webapp,我的页面很少,所有内容都在一个html页面中,并且为了页面导航和幻灯片效果,我使用了iui框架

when there is lot of content i can scroll vertically up and down which is fine however what i have also noticed is if i drag the page horizontally either left to right or right to left and also if i drag the page from top left diagonally the entire page is moving in those directions which is not good 当有很多内容时,我可以垂直向上和向下滚动,这很好,但是我还注意到的是,如果我将页面水平从左到右或从右到左向左拖动,并且如果我从左上角对角拖动整个页面页面朝着那些方向移动,这不好

i would like this movement to be locked and even if i use the finger to slide across or diagonally the page should stay fixed and should only move vertically up or down 我希望锁定此运动,即使我用手指滑过或对角滑动,页面也应保持固定,并且只能垂直向上或向下移动

do i need to write any meta tag to avoid this movement. 我需要写任何元标记来避免这种移动吗?

using only html css and javascript is there a way to fix this or are there any other alternatives without creating the app natively using xcode 仅使用html css和javascript有没有一种方法可以解决此问题,或者是否有其他替代方法而无需使用xcode本地创建应用

If the webpage is wider than the width of the viewport then the behavior you describe will occur. 如果网页的宽度大于视口的宽度,则将发生您描述的行为。 However if you ensure the content width is set to 320px (and no child transparent-ish elements are pushing content past that demarcation point) then you shouldn't be able to scroll sideways. 但是,如果您确保内容宽度设置为320px(并且没有子级的透明元素将内容推过该分界点),则您将无法横向滚动。

If that's not working for you, you should be able to use the touchstart/move/end events and disable the default behavior in javascript using preventDefault() on the event object - http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/ 如果这不适合您,则应该能够使用touchstart / move / end事件,并使用事件对象上的preventDefault()在javascript中禁用默认行为-http: //www.sitepen.com/blog/2008/ 07/10 / iPhone上的触摸和手势/

Hey Sudhakar! 嘿Sudhakar! Why not using the list? 为什么不使用列表?

First, check if your viewport meta is correct. 首先,检查您的视口元是否正确。 Then, perhaps a media (image) is larger than the global viewport. 然后,也许媒体(图像)大于全局视口。

Last, this could also due to a width: 100% + some padding/margin. 最后,这也可能是由于宽度:100%+一些填充/边距。 To fix that, box-sizing: border-box; 要解决此问题,请调整框大小:border-box; could be your friend 可能是你的朋友

R. R.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM