Viewing 11 posts - 1 through 11 (of 11 total)
  • Question

    #37600
    @rings06

    Hello,

    is it possible to have the menu automatically closed when I’m on the iPad.

    thanks.

    Answers

    #37663

    Alyssa
    Participant
    @alyssa-buddyboss

    @rings06 welcome to the buddyboss community! Add this to your child theme’s functions.php file:

    function tablet_closed_menu(){
    	?>
    <script>
    if ($( "body" ).hasClass("tablet") && !$( "body" ).hasClass( "page-template-page-no-buddypanel" ) ) {
        $( "body" ).removeClass( "left-menu-open");
      }
      </script>
    <?
      }
    add_action('wp_footer','tablet_closed_menu',99999);
    #37694
    @rings06

    Hello,

    I just tried the menu is always open on ipad.

    Thanks

    #37705

    Alyssa
    Participant
    @alyssa-buddyboss

    @rings06 can you send em a link to your site?

    #37707
    @rings06
    #37708

    Alyssa
    Participant
    @alyssa-buddyboss

    Here is a slight edit to the code to check iPad in the useragent:

    function tablet_closed_menu(){
    	?>
    <script>
    
    if ((( /iPad|tablet/i.test(navigator.userAgent) ) || $( "body" ).hasClass("tablet")) && !$( "body" ).hasClass( "page-template-page-no-buddypanel" ) ) {
        $( "body" ).removeClass( "left-menu-open");
      }
    
      </script>
    <?
      }
    add_action('wp_footer','tablet_closed_menu',99999);
    #37709

    Alyssa
    Participant
    @alyssa-buddyboss

    You may want to try disabling plugins like scroll to top to see if there is a plugin conflicting with the script it works dandy on my dev server and plugin like scroll to top are known to cause conflicts. Try disabling other plugins as well.

    #37737
    @rings06

    It works great but I have a message that is displayed with the min ipad configuration.

    Can we not put this message.

    Thank you.

    Best Regards.

    #37739

    Alyssa
    Participant
    @alyssa-buddyboss

    @rings06 so sorry, that was my debugging code 🙂 Code fixed inline above

    #37749
    @rings06

    It’s perfect !!

    Thanks.

    #37809

    Alyssa
    Participant
    @alyssa-buddyboss

    No problem, I’ll close this issue out.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The question ‘Ipad’ is closed to new replies.