• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How To Change Menu Behavior on iOS devices?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › General Genesis Framework Discussions › How To Change Menu Behavior on iOS devices?

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  Rob Mc 1 week, 2 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 5, 2021 at 11:30 pm #503687

    Rob Mc
    Participant

    Team StudioPress,

    I have an issue with a website that has a lengthy submenu that requires scrolling when a mobile device is in landscape. For smaller devices, it's no big deal, because the actual mobile menu is engaged. However, on iPad and iPad Pro in landscape, it's a big issue.

    Long story short, the JS for menus in Genesis Framework specifically wants to close menus when clicking outside the menu - which makes scrolling to get to the items at the bottom of the submenu impossible.

    Here is the relevant code in Genesis Framework:

    ios = (function () {
    				var ios = /^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);
    				if (ios) {
    					// tap anywhere on iOS to unfocus a submenu
    					$('html').css('cursor', 'pointer').on('click', $.noop);
    				}
    				return ios;
    			})(),
    

    How can I adjust this in my theme, so that website visitors on iPad and iPad Pro will be able to see the full menu?

    Research is indicating that it's essential to differentiate "click" from "touchstart" as iOS tends to interpret either action as a click and, thus, close the menu. However, sadly, my JS is not good enough to figure out how to do this and then add it to the theme.

    Has anyone tried to do this before? If so, how can it be done?

    Thanks,
    Rob Mc

    https://modfarmsites.com/decastell
    April 7, 2021 at 5:28 pm #503706

    Rob Mc
    Participant

    I found this searching around the internet that separates the two actions (click and touchstart), but am unsure how (and where) to place that in my theme to separate the actions.

    <script>
            $("#button").on('touchstart click', function(event) {
                if (event.type == "touchstart") {
                    $(this).off('click');
                    console.log("Only touch event is fired");
                } else if (event.type == "click") {
                    $(this).off('touchstart');
                    console.log("Only click event is fired");
                }
            });
        </script>
    
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2021 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble