Skip to content

Instantly share code, notes, and snippets.

@csavoronin
Last active February 25, 2020 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csavoronin/1dcf0eba6e00decba3d8ce2fb5804477 to your computer and use it in GitHub Desktop.
Save csavoronin/1dcf0eba6e00decba3d8ce2fb5804477 to your computer and use it in GitHub Desktop.
[!] Design: Responsive: Menu: 4.9.x: On iOS 13, the second level menu did not work. Fixed. Information about applying changes: http://docs.cs-cart.com/latest/upgrade/apply_diff_file.html
diff --git a/js/tygh/responsive.js b/js/tygh/responsive.js
index df79fd47ac..9a2f243acc 100644
--- a/js/tygh/responsive.js
+++ b/js/tygh/responsive.js
@@ -157,20 +157,31 @@
$('.ty-menu__submenu-to-right').removeClass('ty-menu__submenu-to-right');
var submenu, position;
+ // FIXEME: iOS 13 bug with visibility: hidden
// Detect menu collisions
- if(menuItemElm) {
- if(typeof menuItemElm.offset() !== "undefined") {
- menuWidth = menuWidth - (menuItemElm.offset().left - menuOffset.left)
- }
- submenu = $('.cm-responsive-menu-submenu', menuItemElm).first();
+ // if(menuItemElm) {
+ // if(typeof menuItemElm.offset() !== "undefined") {
+ // menuWidth = menuWidth - (menuItemElm.offset().left - menuOffset.left)
+ // }
+ // submenu = $('.cm-responsive-menu-submenu', menuItemElm).first();
- if(submenu.length) {
- submenu.css({visibility: "hidden", left: 0});
- position = submenu.outerWidth();
- if(position > menuWidth) {
+ // if(submenu.length) {
+ // submenu.css({visibility: "hidden", left: 0});
+ // position = submenu.outerWidth();
+ // if(position > menuWidth) {
+ // submenu.parent().addClass('ty-menu__submenu-to-right');
+ // }
+ // submenu.css({visibility: "", left: "auto"});
+ // }
+
+ // }
+ if (menuItemElm) {
+ var submenu = $('.cm-responsive-menu-submenu', menuItemElm);
+ if (submenu.length) {
+ var position = submenu.position().left + submenu.width();
+ if (position > menuWidth) {
submenu.parent().addClass('ty-menu__submenu-to-right');
}
- submenu.css({visibility: "", left: "auto"});
}
}
@yorgosf
Copy link

yorgosf commented Feb 24, 2020

hi Sir it is not clear enough how we can fix this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment