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"});
}
}
@csavoronin
Copy link
Author

The fix should be included in the next CS-Cart release.

If you want to apply in in CS-Cart version 4.9.x, you can use this diff file.
If you want to apply in in CS-Cart version 4.10.x, you can use the following diff file:
https://gist.github.com/csavoronin/4ae71b395c267488d51c7dba3d4530e5

For more information about applying changes, please refer to the following article:
http://docs.cs-cart.com/latest/upgrade/apply_diff_file.html

Thank you.

@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