maintainScrollPositionOnPostBack

maintainScrollPositionOnPostBack

本文介绍了“maintainScrollPositionOnPostBack =”真“,”不与谷歌Chrome浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!


  1. 的Web.config级别=>页maintainScrollPositionOnPostBack =真/>

  1. Web.config Level => pages maintainScrollPositionOnPostBack="true" />

页级别=><%@页MaintainScrollPositionOnPostback =真正的%>

Page Level => <%@ Page MaintainScrollPositionOnPostback="true" %>

code水平=> Page.MaintainScrollPositionOnPostBack = TRUE;

Code Level => Page.MaintainScrollPositionOnPostBack = true;

浏览器级别=>浏览器ID =铬的parentID =Safari1Plus>
能力>
  功能名=supportsMaintainScrollPositionOnPostbackVALUE =真/>
能力>
浏览器>

Browser Level => browser id="Chrome" parentID="Safari1Plus">capabilities> capability name="supportsMaintainScrollPositionOnPostback" value="true" />capabilities>browser>

所有的4种方式上面提到的没有与谷歌的Chrome浏览器工作。这是工作的罚款与Firefox。请提供任何解决方案。

Any of the 4 ways mentioned above did not work with google chrome. It is working fine with firefox. Kindly provide any solution .

推荐答案

您可以将此片段添加到您的ASP.NET页/母版(需jQuery的):

You can add this snippet to your ASP.NET Page/MasterPage (jQuery required):

<asp:HiddenField runat="server" ID="hfPosition" Value="" />
<script type="text/javascript">
    $(function () {
        var f = $("#<%=hfPosition.ClientID%>");
        window.onload = function () {
            var position = parseInt(f.val());
            if (!isNaN(position)) {
                $(window).scrollTop(position);
            }
        };
        window.onscroll = function () {
            var position = $(window).scrollTop();
            f.val(position);
        };
    });
</script>

这篇关于“maintainScrollPositionOnPostBack =”真“,”不与谷歌Chrome浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 08:07