WordPress.org

Ready to get started?Download WordPress

Forums

Responsive Menu
[resolved] Possible to change width detection to device detection (3 posts)

  1. jessicalane
    Member
    Posted 3 months ago #

    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/

  2. Peter Featherstone
    Member
    Plugin Author

    Posted 3 months ago #

    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

  3. gerugersten
    Member
    Posted 1 month ago #

    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 :-)

Reply

You must log in to post.

About this Plugin

About this Topic