Преглед изворни кода

#103 close opened sliding menu when main menu is hiding

Alex Trofimov пре 11 година
родитељ
комит
5f80903740
3 измењених фајлова са 23 додато и 14 уклоњено
  1. 12 9
      inc/js/functions.js
  2. 3 0
      modules/boonex/ocean/data/template/system/_header.html
  3. 8 5
      template/_header.html

+ 12 - 9
inc/js/functions.js

@@ -352,12 +352,6 @@ function bx_menu_slide (jSel, e, sPosition) {
         eSlider.slideUp()
     };
 
-    var fCloseAllOpened = function () {
-        $('.bx-sliding-menu-main:visible, .bx-popup-slide-wrapper:visible').each(function () {
-            bx_menu_slide('#' + this.id);
-        });
-    }
-
     var fOpen = function () {
         if (eIcon.length) {
             eIcon.attr('data-icon-orig', eIcon.attr('data-icon'));
@@ -384,7 +378,7 @@ function bx_menu_slide (jSel, e, sPosition) {
         $(window).off('resize.bx-sliding-menu');
     }
     else {
-        fCloseAllOpened();
+        bx_menu_slide_close_all_opened();
 
         $(document).off('click.bx-sliding-menu touchend.bx-sliding-menu');
         $(window).off('resize.bx-sliding-menu');
@@ -404,20 +398,29 @@ function bx_menu_slide (jSel, e, sPosition) {
                 if ($(this).width() == iWidthPrev)
                     return;
                 iWidthPrev = $(this).width();
-                fCloseAllOpened();
+                bx_menu_slide_close_all_opened();
             });
  
             $(document).on('click.bx-sliding-menu touchend.bx-sliding-menu', function (event) {
                 if ($(event.target).parents('.bx-sliding-menu-main, .bx-popup-slide-wrapper, .bx-db-header').length || $(event.target).filter('.bx-sliding-menu-main, .bx-popup-slide-wrapper, .bx-db-header').length || e === event.target)
                     event.stopPropagation();
                 else
-                    fCloseAllOpened();
+                    bx_menu_slide_close_all_opened();
             });
 
         }, 10);
     }
 }
 
+/**
+ * Close all opened sliding menus
+ */
+function bx_menu_slide_close_all_opened () {
+    $('.bx-sliding-menu-main:visible, .bx-popup-slide-wrapper:visible').each(function () {
+        bx_menu_slide('#' + this.id);
+    });
+}
+
 /**
  * Set ACL level for specified profile
  * @param iProfileId - profile id to set acl level for

+ 3 - 0
modules/boonex/ocean/data/template/system/_header.html

@@ -69,6 +69,9 @@
                   initial: "bx-toolbar-anim",
                   pinned: "bx-toolbar-reset",
                   unpinned: "bx-toolbar-up"
+                },
+                onUnpin: function() {
+                    bx_menu_slide_close_all_opened();
                 }
             }).init();
         });

+ 8 - 5
template/_header.html

@@ -60,14 +60,17 @@
             // hide toolbar on scrolldown, show - on scroll up
             new Headroom($('#bx-toolbar').get(0), {
                 tolerance: {
-                  down: 10,
-                  up: 20
+                    down: 10,
+                    up: 20
                 },
                 offset: 200,
                 classes: {
-                  initial: "bx-toolbar-anim",
-                  pinned: "bx-toolbar-reset",
-                  unpinned: "bx-toolbar-up"
+                    initial: "bx-toolbar-anim",
+                    pinned: "bx-toolbar-reset",
+                    unpinned: "bx-toolbar-up"
+                },
+                onUnpin: function() {
+                    bx_menu_slide_close_all_opened();
                 }
             }).init();
         });