jquery滚动页面中的问题到更新面板中的页面顶部

时间:2015-10-05 11:38:28

标签: javascript jquery asp.net

我在aspx页面中使用更新面板,我希望每当页面部分加载时,页面应该在页面顶部滚动。 我写了jquery为

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function () {
    // re-bind your jQuery events here
    this.window.scrollTo(0, 0);
    alert("helloo");
});

以上jquery无法正常工作!请帮忙!!!

1 个答案:

答案 0 :(得分:0)

最有可能的是,您的脚本包含在UpdatePanel内容之外。在更新面板中包含脚本。

此外,请考虑更改命令以执行滚动:

 $("html, body").scrollTop(0);
 $("html, body").scrollLeft(0);