I want to remove the vertical scroll bar after switching to full screen mode.
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 tried this without success:
<script type="text/javascript"> if(window.fullScreen) { $("html").css("overflow", "hidden"); } else { $("html").css("overflow", "auto"); } </script>
Tank as always.
EDIT: <script type="text/javascript" src="jquery.js"></script> loading, and another jquery script is working fine.
EDIT: I tested with:
$(document).ready(function() { $("body").css("overflow", "hidden"); });
And it works! Therefore, I believe that for some reason, the JavaScript condition code does not work! 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, do not forget to attach the function to the body, for example:
<body onkeydown="scrollbar();">
UPDATE:
Work in chrome, opera, i.e. safari except firefox! What can be done to fix firefox?