Tagged: x
-
AuthorPosts
-
December 6, 2016 at 9:58 am #1283267
amp368ParticipantHey there, I’ve used this bit of code to make the mobile menu collapse:
(function($){ $('.x-navbar .x-nav-wrap.mobile a').on('touchend click', function(){ $('.x-nav-wrap.mobile').toggleClass('in').css('height', 0); $('.x-btn-navbar').toggleClass('collapsed'); }); })(jQuery);but doing so causes a link to a modal box to not work on iOS safari.
It works fine on everything else.
It’s a simple anchor link so I’m wondering what could be going on.The website is http://hlxusa.com/ and the link is careers.
Any chance you could help?Cheers
December 6, 2016 at 1:48 pm #1283563
Nabeel AModeratorHi there,
Thanks for writing in! Try replacing your code with this:
jQuery(document).ready(function($){ $('.x-nav-wrap.mobile a').on('touchstart', function(e) { $('.x-nav-wrap.mobile').click(); }); });Don’t forget to clear your browser’s cache after adding the code. Let us know how this goes!
December 6, 2016 at 3:20 pm #1283668
amp368ParticipantThanks for the response!
Unfortunately that didn’t work.
The menu remains open when you click a link, but the modal works.It’s the same result as if there were no code at all.
I’ve left it in place so you can take a look.
December 7, 2016 at 12:35 am #1284134
Paul RModeratorHi,
Kindly change it to this.
jQuery(document).ready(function($){ $('.x-nav-wrap.mobile a').on('click touchstart', function(e) { $('.x-btn-navbar').click(); }); });This is how it works after adding the code.
See Video – http://screencast.com/t/fLVMvUDD
December 7, 2016 at 8:29 am #1284611
amp368ParticipantHi there, sorry that didn’t work either.
It has the same effect as the code I originally posted.
Everything works as it should except for the careers link on iOS Safari.
Nothing happens when it’s clicked.December 7, 2016 at 2:10 pm #1285029
RadModeratorHi there,
Please try this
jQuery(document).ready(function($){ $('.x-nav-wrap.mobile a').off('touchstart touchend').on('click touchstart', function(e) { $('.x-btn-navbar').click(); }); setTimeout ( function(){ $('.x-nav-wrap.mobile a').off('touchstart touchend'); }, 1000); //Let's make sure it's off });It’s not working due to touch events, they are captured and not propagated.
Thanks!
December 7, 2016 at 5:35 pm #1285269
amp368ParticipantThat did it!
Thanks so much, you guys are the best!December 7, 2016 at 11:08 pm #1285629
Prasant RaiModeratorThanks for the good words. It means a lot to us. Feel free to let us know if you face any other issue. We’ll be happy to assist you. 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1283267 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
