From d162e689daf6b5f401c29f6772a6ee8b65d8f509 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 8 May 2017 15:14:31 +0200 Subject: [PATCH] frio mobile: disable page scroll when aside is shown --- view/theme/frio/css/style.css | 2 ++ view/theme/frio/js/theme.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 937e55042a..e787384eda 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -127,6 +127,8 @@ code { opacity: 1; } + /* prevent page scroll when the aside is opened **/ + body.aside-out { overflow: hidden; } } /* * standard page elements diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index a335fffbdb..047cce16b0 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -338,6 +338,21 @@ $(document).ready(function(){ $(document.body).trigger("sticky_kit:recalc"); }); } + + /* + * Add or remove "aside-out" class to body tag + * when the mobile aside is shown or hidden. + * The class is used in css to disable scroll in page when the aside + * is shown. + */ + $("aside") + .on("shown.bs.offcanvas", function() { + $("body").addClass("aside-out"); + }) + .on("hidden.bs.offcanvas", function() { + $("body").removeClass("aside-out"); + }); + }); function openClose(theID) {