window.scrollTo()无法正常工作 [英] window.scrollTo() not working

查看:1154
本文介绍了window.scrollTo()无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

window.scrollTo(0,0); 

所需结果:页面向上滚动

Desired result: page scrolls up to top

尝试将其附加到按钮单击上,没有任何反应.

Tried it attached to button click and nothing happens.

我有信息页面,当用户单击底部的下一页/上一页按钮时,我希望窗口向上滚动到顶部.

I have pages of information and when the user clicks on the next/previous page button at the bottom, I want the window to scroll back up to the top.

这是怎么回事?我们应该在App Maker中使用其他App Maker方法吗?

What's going wrong here? Is there some other App Maker method we're supposed to use within App Maker?

推荐答案

签出:我还没有尝试过,但是从这篇文章中可以看到:

I haven't tried this, but from this post something like:

var element = app.currentPage.getElement();
element.scrollTop = 0;
// (And if you need left as well)
element.scrollLeft = 0;

这篇关于window.scrollTo()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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