From ff4b21e0f53c8158bfac04a08e054c58d8a8a555 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 8 Feb 2019 16:01:34 +0100 Subject: [PATCH] fix #2587 @2 --- .../perfect-scrollbar.jquery.js | 29 +++++++++++++++++-- style/mmenu/mmenu.less | 1 + 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js b/js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js index 626eb791..35844115 100644 --- a/js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js +++ b/js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js @@ -1,16 +1,39 @@ (function ($) { function JQperfectScrollbar(element, options) { this.element = $(element).get(0); + if(options===undefined || options==null){ + options={}; + } this.ps = new PerfectScrollbar(this.element, options); } - JQperfectScrollbar.prototype = {}; + JQperfectScrollbar.prototype = { + update: function () { + this.ps.update(); + }, + destroy: function () { + this.ps.destroy(); + this.ps = null; + } + }; jQuery.fn.perfectScrollbar = function (options) { return this.each(function () { var $this = $(this); - if ($(this).data('perfectScrollbar') === undefined) { - $(this).data('perfectScrollbar', new JQperfectScrollbar($this, options)); + var jps = $(this).data('perfectScrollbar'); + var create = false; + if (jps === undefined) { + jps = new JQperfectScrollbar($this, options); + $(this).data('perfectScrollbar', jps); + create = true; + } + if (options === 'update') { + jps.update(); + } else if (!create) { + console.log('destroy'); + jps.destroy(); + jps = new JQperfectScrollbar($this, options); + $(this).data('perfectScrollbar', jps); } }) }; diff --git a/style/mmenu/mmenu.less b/style/mmenu/mmenu.less index aa61e13a..8a260da1 100644 --- a/style/mmenu/mmenu.less +++ b/style/mmenu/mmenu.less @@ -274,6 +274,7 @@ html.mm-opening .mm-menu.mm-opened[class*=mm-pagedim] ~ #mm-blocker { } #menuSearchResults, #menuSearchHints { + position: relative; display: none; // Hidden by default, displayed via JS } -- 2.39.5