Wednesday, 18 July 2018

Scroll Lock and Unlock in JavaScript / Jquery

Scrolling in JavaScript/Jquery : 


Scroll Lock in Any Control :

It will Lock at particular Position of Window.
  <script>
     $(document).ready(function () {  
           $(window).scroll(function scroll() { 
                  window.scrollTo(0, 200); 
           });
     });
</script>

or $(window).on();

In C# Source Code put this One :

 ScriptManager.RegisterStartupScript(Page, GetType(), "scroll", "<script> $(document).ready(function () {   $(window).scroll(function scroll() { window.scrollTo(0, 200); }); });</script>", false);

Scroll UNLock in Any Control :

   $(window).off('scroll');

In C# Source Code put this One :

 ScriptManager.RegisterStartupScript(Page, GetType(), "scroll", "<script> $(document).ready(function () {    $(window).off('scroll'); });</script>", false);

No comments:

Post a Comment

Top Agile Interview Questions & Answers

Top Agile Interview Questions & Answers 1. What is Agile Testing? The first question of agile interview question tests your k...