Restoring page scroll position with jQuery

后端 未结 6 1370
春和景丽
春和景丽 2020-12-05 17:21

I have a page operation that uses something like:

$(\'#thetable tbody\').replaceWith(newtbody);

in an ajax callback. Sometimes, if the user

6条回答
  •  隐瞒了意图╮
    2020-12-05 18:01

    Are u use aspx? if it's aspx:

    $(document).ready(function () {
            //------------ scroll-------------
             
            $('body').scrollTop(document.getElementById('<%=hdScroll.ClientID%>').value);
                
            $(window).scroll(function () {
                $("#<%= hdScroll.ClientID %>").val($(window).scrollTop());
                //alert(document.getElementById('<%=hdScroll.ClientID%>').value);
            });
           });
    
      

提交回复
热议问题