Maintain scroller position on Div after page postback (ASP.NET)

后端 未结 6 1067
执念已碎
执念已碎 2021-01-05 05:30

I have a div as such:

I contains a few hundred records and allows me to select an i

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 05:54

    Here is a more refined way of FlySwat's solution using JQuery which worked for me:

        var $ScrollPosition = $('#hfScrollPosition');
        var $ScrollingDiv = $('#pnlGroupDataContent');
        if ($ScrollPosition.length && $ScrollingDiv.length) {
            // Store scrolling value
            $ScrollingDiv.scroll(function () {
                $ScrollPosition.val($ScrollingDiv.scrollTop());
            });
            // Set scrolling
            $ScrollingDiv.scrollTop($ScrollPosition.val());
        }
    

提交回复
热议问题