Solve the Problem of resetting the position of the DIV scroll bar after ASP. NET return

Source: Internet
Author: User
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(){

  1. VaRTop;
  2. VaRLeft;
  3. $ ("# Veto"). Scroll (Function(){
  4. Top = $ ('# veto'). scrolltop ();
  5. Left = $ ('# veto'). scrollleft ();
  6. });
  7. SYS. webforms. pagerequestmanager. getinstance (). add_endrequest (endrequesthandler );
  8. FunctionEndrequesthandler (sender, argS ){
  9. $ ('# Veto'). scrolltop (top );
  10. $ ('# Veto'). scrollleft (left );
  11. }
  12. });
    $(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.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.