Skip to content

Instantly share code, notes, and snippets.

@soc
Created June 10, 2014 23:47
Show Gist options
  • Select an option

  • Save soc/186500f41465a5d97e37 to your computer and use it in GitHub Desktop.

Select an option

Save soc/186500f41465a5d97e37 to your computer and use it in GitHub Desktop.
$(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
});
@soc

soc commented Jun 11, 2014

Copy link
Copy Markdown
Author
  def fixOverflow(ev: jquery.JQueryEventObject) =
    if ((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height))
      jQuery("html").css("overflow", "hidden")
    else
      jQuery("html").css("overflow", "auto")

  jQuery(window).resize(fixOverflow _)
  jQuery(document).ready(() => jQuery(window).resize())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment