WordPress.org

Support

Support » Plugins and Hacks » Responsive Menu » [Resolved] Possible to change width detection to device detection

[Resolved] Possible to change width detection to device detection

  • Hi,

    I’ve been using your plugin on a local version of my site and it’s been great!

    At the moment (as far as i understand) whether the plugin is active or not depends on the size of the screen (and the break point you set in the options).

    Would it be possible for it to use device type rather than screen size? I.e, detect if the device is a touchscreen, and then display the menu immediately?

    Would this be really complicated to do?

    Thank you for your help!

    https://wordpress.org/plugins/responsive-menu/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Jessica,

    Great to hear that you’ve been using and enjoying the plug-in!

    Unfortunately the plug-in works using media queries which detects the screen width and then decides when to show the menu.

    As this is a responsive menu, rather than device specific it is designed to work across desktops, laptops, tablets and mobiles equally.

    You could add custom functionality yourself to achieve this potentially using JavaScript if you know what you are doing in this respect.

    I hope this helps

    Many thanks

    Peter

    Well I just needed the same thing as Jessica and the simplest way to do this is by adding the condition “wp_is_mobile()” to your “responsive-menu.php” file in the plugin folder.

    Should look like this then:

    /* 4.1 Display Responsive Menu on Site ============= */
    if( !is_admin() && wp_is_mobile()) :

    wp_is_mobile() is a funtion in your wp-includes/vars.php to detect if the viewer has a mobile device or not.
    There are some plugins for further detection like is_phone() is_tablet() is_android() etc. referring to this article.

    @peter I really love your plugin and think it would be great if you add at least the option with wp_is_mobile(), as it is given from wordpress 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Possible to change width detection to device detection’ is closed to new replies.
Skip to toolbar