Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6049179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:32:47+00:00 2026-05-23T07:32:47+00:00

I want to remove vertical scrollbar after switch to fullscreen. This is the script

  • 0

I want to remove vertical scrollbar after switch to fullscreen.

This is the script I’m using at the moment:

<script type="text/javascript">
if((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height)) {
    $("html").css("overflow", "hidden");
} else {
    $("html").css("overflow", "auto");
}
</script>

I’ve tried like this without any success:

<script type="text/javascript">
if(window.fullScreen) {
    $("html").css("overflow", "hidden");
} else {
    $("html").css("overflow", "auto");
}
</script>

Tank you as always.

EDIT:
<script type="text/javascript" src="jquery.js"></script> is being loaded and other jquery script’s are working ok.

EDIT:
I’ve tested with:

$(document).ready(function() {
    $("body").css("overflow", "hidden");
});

And it works!
So I believe that for some reason the JavaScript condition code it’s not working!
if((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height))…

EDIT:

Solution found!

<script type="text/javascript">
var control = 0;

function scrollbar(){
    if(event.keyCode == 122 && control == 0){
        //remove scrollbar
        $("body").css("overflow", "hidden");
        control = 1;
    }
    else{
        //add scrollbar
        $("body").css("overflow", "auto");
        control = 0;
    }
}

</script>

If you want to use this don’t forget to attach the function to the body for example like:

<body onkeydown="scrollbar();">

UPDATE:

Work’s in chrome, opera, ie, safari except for firefox! What can be done to fix firefox?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:32:47+00:00Added an answer on May 23, 2026 at 7:32 am

    It looks like the javascript is only being run once, when the document loads, and not re-evaluate afterwards. If this is the only problem, you should see the correct behaviour if you are in full screen then load the page. To fix this you will have to make a function out of your code and call it every time the window is resized. Using jQuery, you can do this using an anonymous function:

    <script type="text/javascript">
    $(window).resize(function() {
        if((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height)) {
            $("html").css("overflow", "hidden");
        } else {
            $("html").css("overflow", "auto");
        }
    });
    
    $(document).ready(function(){
        $(window).resize();
        // trigger the function when the page loads
        // if you have another $(document).ready(), simply add this line to it
    });
    </script>
    

    This binds the function to the resize event handler and you should see correct results! If that works it will be a much nicer and robust way of doing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want remove "Language" querystring from my url. How can I do this? (using
I want to de-activate or remove the vertical scrollbar in an HTML page. How
I'm using subversion (TortoiseSVN) and I want to remove the .svn folders from my
im building a new side with movable type. And i want to remove the
I want to remove www. from my site url. I have added this to
Can I remove the verticl scrollbar on jqgrid, as I want to display all
I want to remove the Vertical slider from QWebView that displays GoogleMap with current
I want remove any number after point. Example $input = '33.892'; $input = '15.274856';
Does anyone know why this never doesn't work: if !exists(g:removenumbchar) if a:type == remove
I want to remove all whitespace characters from a multi-line string using regex. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.