javascricpt to disable Browser Scroll Bar..?

by jugnu 6 replies
Hello Warriors, Following is the javascript to diable broswer scrolling bar and it's working fine but I want to disable browser scrolling bar for specific time. I mean, i want to diable browser scrolling bar for 5 mints and browser scrolling bar should be enable after 5 minuts. please modify the following code to do this. If you have your own html Or javascript to do this, please share here.thanks

HTML Code:
<script type="text/javascript">
onload=function(){
document.documentElement.style.overflow=document.body.style.overflow='hidden';
}
</script>
#programming #bar #browser #disable #javascricpt #scroll
Avatar of Unregistered
  • Profile picture of the author bbleo
    I think you should make an ajax call to do this
    {{ DiscussionBoard.errors[5661325].message }}
  • Profile picture of the author PaybackTony
    Originally Posted by jugnu View Post

    Hello Warriors, Following is the javascript to diable broswer scrolling bar and it's working fine but I want to disable browser scrolling bar for specific time. I mean, i want to diable browser scrolling bar for 5 mints and browser scrolling bar should be enable after 5 minuts. please modify the following code to do this. If you have your own html Or javascript to do this, please share here.thanks

    HTML Code:
    <script type="text/javascript">
    onload=function(){
    document.documentElement.style.overflow=document.body.style.overflow='hidden';
    }
    </script>
    I haven't tested this, but you want to use "setTimeout". I've pasted the code below:

    HTML Code:
    <script type="text/javascript">
    onload=function(){
    document.documentElement.style.overflow=document.body.style.overflow='hidden';
    // now use settimeout to re-enable the scrollbar.
    setTimeout('enableScrolling',300000);
    }
    function enableScrolling()
    {
       document.documentElement.style.overflow=document.body.style.overflow='auto';
    }
    </script>
    Keep in mind, if you just want to test it real quick, change the 300000 number to something small like 3000 (3 seconds).
    {{ DiscussionBoard.errors[5663018].message }}
    • Profile picture of the author jugnu
      Originally Posted by PaybackTony View Post

      I haven't tested this, but you want to use "setTimeout". I've pasted the code below:

      HTML Code:
      <script type="text/javascript">
      onload=function(){
      document.documentElement.style.overflow=document.body.style.overflow='hidden';
      // now use settimeout to re-enable the scrollbar.
      setTimeout('enableScrolling',300000);
      }
      function enableScrolling()
      {
         document.documentElement.style.overflow=document.body.style.overflow='auto';
      }
      </script>
      Keep in mind, if you just want to test it real quick, change the 300000 number to something small like 3000 (3 seconds).
      Thanks for your reply. This is not working. it's not enabling scrolling bar..?
      {{ DiscussionBoard.errors[5663168].message }}
      • Profile picture of the author jugnu
        Anyone else can help me in this regard..?
        {{ DiscussionBoard.errors[5663253].message }}
        • Profile picture of the author PaybackTony
          Originally Posted by jugnu View Post

          Anyone else can help me in this regard..?
          HTML Code:
          <script type="text/javascript">
          onload=function(){
          	document.documentElement.style.overflow=document.body.style.overflow='hidden';
          	// now use settimeout to re-enable the scrollbar.
          	setTimeout(enableScrolling,3000);
          }
          function enableScrolling()
          {
             document.documentElement.style.overflow=document.body.style.overflow='auto';
          }
          </script>
          That will enable it after 3 seconds. Had to take the quotes out of setTimeout. Change the 3000 to 300000 to get it to change after 5 minutes.
          {{ DiscussionBoard.errors[5664021].message }}

Trending Topics