简体   繁体   English

在 iPad 上模拟滚动事件

[英]Simulate scroll event on iPad

Generally speaking, on an iPad, if we have a fixed width/height iframe element, it should scroll automatically using 2-fingers..一般来说,在 iPad 上,如果我们有一个固定的宽度/高度 iframe 元素,它应该使用 2 指自动滚动。

But because of some issue/bug in the latest IOS, we are unable to scroll the fixed dimension element..但是由于最新的 IOS 中的一些问题/错误,我们无法滚动固定尺寸元素..

So is there any library or any alternate by which I can wither use iframe / object element and add code which would simulate scrolling..那么是否有任何库或任何替代品可供我使用 iframe / object 元素并添加模拟滚动的代码..

I can use object element, in case there is a issue with iframe unable to receive events..But I need either of these, as I have to include a child page..我可以使用 object 元素,以防 iframe 无法接收事件的问题。但我需要其中任何一个,因为我必须包含一个子页面。

This is what your looking for: http://cubiq.org/iscroll Tried it, works fine这就是你要找的东西: http://cubiq.org/iscroll试过了,效果很好

I would use event.initEvent .我会使用event.initEvent However, it's just sugestion - I'm not able to check if it works.但是,这只是建议-我无法检查它是否有效。

I use plain jquery to do the scrolling:我使用普通的 jquery 进行滚动:

function scroll(div, px){
   $(div).animate({scrollTop:$(div).scrollTop()+px}, 400);
}

for 200px, use as:对于 200 像素,用作:

scroll('#my_iframe_id', 200); 

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

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