Web Window API | Window scrollbars property

In Web APIWindow.scrollbars property returns the object of scrollbars, for which we can check the visibility.

Syntax :

objectReference = window.scrollbars

Example : Check the visibility



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        Window scrollbars property
    </title>
  
    <style>
        a:focus {
            background-color: magenta;
        }
    </style>
  
    <script type="text/javascript">
        function getvisibility() {
            document.getElementById('visibility').innerHTML =
              window.scrollbars.visible;
        }
    </script>
  
</head>
  
<body>
    <center>
  
        <h1 style="color:green;">  
                GeeksForGeeks  
            </h1>
  
        <h2>HTML Window scrollbars property</h2>
        <button onclick="getvisibility ();"
                id="btn">
          Check visibility
      </button>
        <p id='visibility'></p>
    </center>
</body>
  
</html>

chevron_right


Output:
Click the button:

When the button is clicked:

Supported Browsers:

  • Google Chrome
  • Edge 12
  • Firefox
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.