Solve the Problem of resetting the position of the DIV scroll bar after ASP. NET return
Code "onclick =" function onclick ()
{
DP. Sh. toolbar. copytoclipboard (this); Return false;
} "Href =" http://shelltea.javaeye.com/blog/564081# ">
$ (Function(){
- VaRTop;
- VaRLeft;
- $ ("# Veto"). Scroll (Function(){
- Top = $ ('# veto'). scrolltop ();
- Left = $ ('# veto'). scrollleft ();
- });
- SYS. webforms. pagerequestmanager. getinstance (). add_endrequest (endrequesthandler );
- FunctionEndrequesthandler (sender, argS ){
- $ ('# Veto'). scrolltop (top );
- $ ('# Veto'). scrollleft (left );
- }
- });
$(function() { var top; var left; $("#veto").scroll(function() { top = $('#veto').scrollTop(); left = $('#veto').scrollLeft(); }); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { $('#veto').scrollTop(top); $('#veto').scrollLeft(left); } });
When ASP. NET Ajax is used in the project, the display area of the DIV with a scroll bar remains unchanged after the return. The above code can solve this problem. Veto is the ID of the DIV with a scroll bar.
This is good and practical. Only jquery is needed.