]> _ Git - fluidbook-html5.git/commitdiff
fix #2587 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Feb 2019 15:01:34 +0000 (16:01 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Feb 2019 15:01:34 +0000 (16:01 +0100)
js/libs/perfect-scrollbar/perfect-scrollbar.jquery.js
style/mmenu/mmenu.less

index 626eb791eca62ac6497165dcfbec477244d42948..35844115855ce5983d4245f594a2d14ffa56ed60 100644 (file)
@@ -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);
             }
         })
     };
index aa61e13a319d012eb1384f17d29afad3c7ebf2aa..8a260da1e6edfcec9bdd69ffb80143e5b7dceba8 100644 (file)
@@ -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
 }