bm-core-ui 2.11.4 → 2.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -890,26 +890,37 @@ BMMenu.prototype = {
890
890
 
891
891
  // Make the menu expand
892
892
  menuNode.style.overflow = 'hidden';
893
- __BMVelocityAnimate(menuNode, {scaleX: 1, scaleY: 1, opacity: 1, translateZ: 0, translateY: 0, translateX: 0}, {
893
+
894
+ __BMVelocityAnimate(menuNode, {opacity: 1}, {
895
+ duration,
896
+ easing
897
+ }, BMMENU_USE_WEB_ANIMATIONS);
898
+
899
+ __BMVelocityAnimate(menuNode, {scaleX: 1, scaleY: 1, translateZ: 0, translateY: 0, translateX: 0}, {
894
900
  duration,
895
901
  easing,
896
902
  complete: _ => {
897
903
  menuNode.style.pointerEvents = 'all';
898
904
  menuContainer.style.pointerEvents = 'all';
899
- menuNode.style.overflow = '';
900
905
  }
901
906
  }, BMMENU_USE_WEB_ANIMATIONS);
902
907
 
903
908
  // Animate each child node in
904
909
  let delay = 50;
905
- for (let child of menuNode.childNodes) {
910
+ let delayIncrement = Math.min(16, 150 / menuNode.childNodes.length);
911
+
912
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
913
+ const child = menuNode.childNodes[i];
906
914
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
907
915
  __BMVelocityAnimate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
908
916
  duration: 100,
909
917
  easing: 'easeOutQuad',
910
- delay: delay
918
+ delay: delay,
919
+ complete: i == menuNode.childNodes.length - 1 ? () => {
920
+ menuNode.style.overflow = '';
921
+ } : undefined,
911
922
  }, BMMENU_USE_WEB_ANIMATIONS);
912
- delay += 16;
923
+ delay += delayIncrement;
913
924
  }
914
925
 
915
926
  // Retain the preivously focused node, to restore its focus when the menu closes
@@ -1047,20 +1058,25 @@ BMMenu.prototype = {
1047
1058
  complete: _ => {
1048
1059
  menuNode.style.pointerEvents = 'all';
1049
1060
  menuContainer.style.pointerEvents = 'all';
1050
- menuNode.style.overflow = '';
1051
1061
  }
1052
1062
  });
1053
1063
 
1054
1064
  // Animate each menu item in
1055
1065
  let delay = 0;
1056
- for (let child of menuNode.childNodes) {
1066
+ let delayIncrement = Math.min(16, 150 / menuNode.childNodes.length);
1067
+
1068
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
1069
+ const child = menuNode.childNodes[i];
1057
1070
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
1058
1071
  (window.Velocity || $.Velocity).animate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
1059
1072
  duration: 100,
1060
1073
  easing: 'easeOutQuad',
1061
- delay: delay
1074
+ delay: delay,
1075
+ complete: i == menuNode.childNodes.length - 1 ? () => {
1076
+ menuNode.style.overflow = '';
1077
+ } : undefined,
1062
1078
  });
1063
- delay += 16;
1079
+ delay += delayIncrement;
1064
1080
  }
1065
1081
 
1066
1082
  // Retain the preivously focused node, to restore its focus when the menu closes
@@ -1377,7 +1393,7 @@ BMMenu.prototype = {
1377
1393
 
1378
1394
  this._isSupermenuClosing = NO;
1379
1395
 
1380
- this._node.style.pointerEvents = 'none';
1396
+ this._node.style.overflow = 'hidden';
1381
1397
 
1382
1398
  __BMVelocityAnimate(this._node, {
1383
1399
  scaleX: this._kind == BMMenuKind.PullDownMenu ? 1 : scale,