javascript - How to stop default scrolling after postback? -
i want scroll top after post back. in login page when click on login button , if there validation error message scrolls bottom. not bottom scroll down first text field. want stop default scrolling , want scroll top. using following code:
<script type="text/javascript"> jquery(document).ready(function () { jquery("#scrolltop").val(0); var prm = sys.webforms.pagerequestmanager.getinstance(); prm.add_endrequest(function (s, e) { jquery("#scrolltop").val(0); window.scrollto(0, 0); $('html, body').animate({ scrolltop: 0 }, 'fast'); // alert('postback end!'); }); prm.add_beginrequest(function (s, e) { jquery("#scrolltop").val(0); window.scrollto(0, 0); $('html, body').animate({ scrolltop: 0 }, 'fast'); }); });
this code working fine after endrequest page scroll bottom. using code page scrolls top , middle of page.
please me resolve this.
if c# , asp.net, might after property called maintainscrollpositiononpostback
Comments
Post a Comment