Просмотр исходного кода

Ticket #1524 - Usage in Albums' Media and update on menu item resize.

AntonLV 8 лет назад
Родитель
Сommit
928a7ee334

+ 8 - 4
inc/js/classes/BxDolMenuMoreAuto.js

@@ -24,6 +24,10 @@ function BxDolMenuMoreAuto(options)
         $(window).on('resize', function() {
            $this.update();
         });
+
+        $($this._sClassItem).on('resize', function() {
+            $this.update(true);
+        });
     });
 }
 
@@ -53,7 +57,7 @@ BxDolMenuMoreAuto.prototype.init = function() {
     });
 };
 
-BxDolMenuMoreAuto.prototype.update = function()
+BxDolMenuMoreAuto.prototype.update = function(bForceCalculate)
 {
     var $this = this;
 
@@ -64,7 +68,7 @@ BxDolMenuMoreAuto.prototype.update = function()
 
         var iMenu = 0;
         oMenu.children($this._sClassItem + ':visible').each(function() {
-            iMenu += $this._getWidth($(this));
+            iMenu += $this._getWidth($(this), bForceCalculate);
         });
 
         var iParent = oMenu.parent().width();
@@ -143,10 +147,10 @@ BxDolMenuMoreAuto.prototype._moveFromSubmenu = function(oMenu, oItemMore, oItemM
         oItemMore.hide();
 };
 
-BxDolMenuMoreAuto.prototype._getWidth = function(oItem)
+BxDolMenuMoreAuto.prototype._getWidth = function(oItem, bForceCalculate)
 {
     var iItem = parseInt(oItem.attr(this._sKeyWidth));
-    if(iItem)
+    if(!bForceCalculate && iItem)
         return iItem;
 
     iItem = oItem.outerWidth(true);

+ 9 - 1
modules/boonex/albums/template/css/main.css

@@ -35,7 +35,7 @@
     -ms-flex: 0 0 100%;
     flex: 0 0 100%;
 
-    overflow: hidden;
+    max-width: 100%;
 }
 
 .bx-albums-media-wrapper .bx-albums-unit-size {
@@ -51,6 +51,8 @@
     -webkit-flex: 0 0 49.8%;
     -ms-flex: 0 0 49.8%;
     flex: 0 0 49.8%;
+    
+    max-width: 49.8%;
 }
 
 /* MEDIA: tablet2 */
@@ -61,6 +63,8 @@
     -webkit-flex: 0 0 49.8%;
     -ms-flex: 0 0 49.8%;
     flex: 0 0 49.8%;
+    
+    max-width: 49.8%;
 }
 
 .bx-media-tablet2 .bx-layout-column-wide .bx-albums-medias-wrapper .bx-albums-media-wrapper .bx-albums-unit-size {
@@ -79,6 +83,8 @@
     -webkit-flex: 0 0 49.8%;
     -ms-flex: 0 0 49.8%;
     flex: 0 0 49.8%;
+    
+    max-width: 49.8%;
 }
 
 .bx-media-desktop .bx-layout-column-wide .bx-albums-medias-wrapper .bx-albums-media-wrapper .bx-albums-unit-size {
@@ -91,6 +97,8 @@
     -webkit-flex: 0 0 33.25%;
     -ms-flex: 0 0 33.25%;
     flex: 0 0 33.25%;
+    
+    max-width: 33.25%;
 }
 
 .bx-media-desktop #sys_search_results .bx-albums-medias-wrapper .bx-albums-media-wrapper .bx-albums-unit-size,

+ 1 - 1
template/scripts/BxBaseMenuCustom.php

@@ -33,7 +33,7 @@ class BxBaseMenuCustom extends BxTemplMenu
         $this->_sTmplNameCustomItemMorePopup = 'menu_custom_item_more_popup.html';
 
         $this->_bMoreAuto = false;
-        $this->_sJsObjectMoreAuto = 'oMenuMoreAuto';
+        $this->_sJsObjectMoreAuto = 'oMenuMoreAuto' . bx_gen_method_name($this->_sObject);
 
         $sPrefix = str_replace('_', '-', $this->_sObject);
         $this->_aHtmlIds = array(