在ipad上发布javascript window.scrollto问题 [英] javascript window.scrollto issue on Ipad

查看:87
本文介绍了在ipad上发布javascript window.scrollto问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下代码行的JavaScript:

I have a javascript that includes following line of code:

window.scrollto(x,y);

其中x和y是应该滚动的位置的坐标。

where x and y are the coordinates of the position where there should be scrolled.

这在台式电脑上工作正常,但如果我在Ipad上试用它就无法正常滚动。

This works fine on desktop computers but if I try it on an Ipad it does not scroll properly.

如果我在window.scroll命令之前放置一个alert()语句,它会正确地滚动。
有谁知道修复?
顺便说一下ipad使用ios7。

If I put an alert() statement before the window.scroll command it srolls properly. Does anyone know of a fix? Btw the ipad uses ios7.

谢谢

推荐答案

执行此操作:


window.setTimeout(function(){window.scrollTo(x,y);},0);

window.setTimeout(function() {window.scrollTo(x,y);}, 0);

也要注意这种情况,scrollto与javascript中的scrollTo不同。

also be aware of the case, scrollto is different to scrollTo in javascript.

这篇关于在ipad上发布javascript window.scrollto问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆