bm-core-ui 2.11.4 → 2.11.5

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.
@@ -896,20 +896,25 @@ BMMenu.prototype = {
896
896
  complete: _ => {
897
897
  menuNode.style.pointerEvents = 'all';
898
898
  menuContainer.style.pointerEvents = 'all';
899
- menuNode.style.overflow = '';
900
899
  }
901
900
  }, BMMENU_USE_WEB_ANIMATIONS);
902
901
 
903
902
  // Animate each child node in
904
903
  let delay = 50;
905
- for (let child of menuNode.childNodes) {
904
+ let delayIncrement = Math.min(16, 100 / menuNode.childNodes.length);
905
+
906
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
907
+ const child = menuNode.childNodes[i];
906
908
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
907
909
  __BMVelocityAnimate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
908
910
  duration: 100,
909
911
  easing: 'easeOutQuad',
910
- delay: delay
912
+ delay: delay,
913
+ complete: i == menuNode.childNodes.length - 1 ? () => {
914
+ menuNode.style.overflow = '';
915
+ } : undefined,
911
916
  }, BMMENU_USE_WEB_ANIMATIONS);
912
- delay += 16;
917
+ delay += delayIncrement;
913
918
  }
914
919
 
915
920
  // Retain the preivously focused node, to restore its focus when the menu closes
@@ -1047,20 +1052,25 @@ BMMenu.prototype = {
1047
1052
  complete: _ => {
1048
1053
  menuNode.style.pointerEvents = 'all';
1049
1054
  menuContainer.style.pointerEvents = 'all';
1050
- menuNode.style.overflow = '';
1051
1055
  }
1052
1056
  });
1053
1057
 
1054
1058
  // Animate each menu item in
1055
1059
  let delay = 0;
1056
- for (let child of menuNode.childNodes) {
1060
+ let delayIncrement = Math.min(16, 100 / menuNode.childNodes.length);
1061
+
1062
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
1063
+ const child = menuNode.childNodes[i];
1057
1064
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
1058
1065
  (window.Velocity || $.Velocity).animate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
1059
1066
  duration: 100,
1060
1067
  easing: 'easeOutQuad',
1061
- delay: delay
1068
+ delay: delay,
1069
+ complete: i == menuNode.childNodes.length - 1 ? () => {
1070
+ menuNode.style.overflow = '';
1071
+ } : undefined,
1062
1072
  });
1063
- delay += 16;
1073
+ delay += delayIncrement;
1064
1074
  }
1065
1075
 
1066
1076
  // Retain the preivously focused node, to restore its focus when the menu closes