Disable body scroll javascript (work on all devices)

If u try to disabled scroll with body overflow:hidden, thats will not work on ios devices. I know method how to fix it. There is only one way to disable page body scrolling (its need for nav or mobile open, on most sites). U need add position:fixed to your global container or body tag, and overflow:hidden. In this case, the scrolling will turn off, but the page will jump when the scroll is turned off and on. For fix that, u need track the scroll position.top() and add negation position.top() to your cotnainer or body. After, if u want to enable scrolling, u must scrolling page on jаvascript to needed position. 

For example:

Function to prevent page blinking when scroll is hidden:

function getScrollbarWidth() {
  var outer = document.createElement("div");
  outer.style.visibility = "hidden";
  outer.style.width = "100px";
  outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
  var widthNoScroll = outer.offsetWidth;
  outer.style.overflow = "scroll";
  var inner = document.createElement("div");
  inner.style.width = "100%";
  var widthWithScroll = inner.offsetWidth;
  return widthNoScroll - widthWithScroll;

Function for disable scroll:

function disableScroll(className) {
  var getScroll = window.scrollY;
  document.body.style.top = '-'+getScroll+'px'
  document.body.style.maxWidth = "calc(100% - "+getScrollbarWidth()+"px)";

For different blocks, we need to disable the scroll at different resolutions, so we pass the юclass to the function.

Function for enable scroll:

function enableScroll(className) {
  var scrollY = document.body.style.top;
  document.body.style.top = '';
  document.body.style.maxWidth = '';
  window.scrollTo(0, parseInt(scrollY || '0') * -1);

And css style for example class:

  position fixed
  width 100%