WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Thirteen
[resolved] Smartphone menu broken (9 posts)

  1. benutzerfreund
    Member
    Posted 8 months ago #

    I created a child theme based on twenty thirtyteen which works fine.

    But somehow I broke the menu for small screens. The "Menu" button shows up when the window is smaller than 480px. But nothing happens when I click on it.

    The elements are still there, when inspecting the page I see them in the HTML code.

    You can see the mess here: http://www.benutzerfreun.de

    Any hint appreciated!

  2. benutzerfreund
    Member
    Posted 8 months ago #

    Ok, I have no idea why, but the JavaScript which is necessary for this was missing. Adding it to footer.php of my child theme as a developer proposed, did fix this.

    Does anyone have any idea why this happens and where I should place this function correctly - my solutions seems like a bad hack.

  3. ron22
    Member
    Posted 7 months ago #

    can you please post your footer code, I have the same problem and wanting to see how to add the code
    thanks

  4. esmi
    Forum Moderator
    Posted 7 months ago #

    @ron22: If you require assistance then, as per the Forum Welcome, please post your own topic.

  5. benutzerfreund
    Member
    Posted 7 months ago #

    @ron22: As you might have noticed, everything on my site is fine now. The trick was to add this code to footer.php:

    /**
    * Enables menu toggle for small screens.
    */
    ( function() {
    var nav = $( '#site-navigation' ), button, menu;
    if ( ! nav )
    return;
    button = nav.find( '.menu-toggle' );
    if ( ! button )
    return;
    // Hide button if menu is missing or empty.
    menu = nav.find( '.nav-menu' );
    if ( ! menu || ! menu.children().length ) {
    button.hide();
    return;
    }
    $( '.menu-toggle' ).on( 'click.twentythirteen', function() {
    nav.toggleClass( 'toggled-on' );
    } );
    } )();

    I suppose, it is a dirty hack - so if you come up with a better solution, please post this here…

  6. mosign
    Member
    Posted 3 months ago #

    hej @benutzerfreund,

    sounds good, but does still/again not work on your site, did you notice? im looking for a solution for the same problem and cant solve it! why did u put the code to the footer file, shouldnt it be in the header template? i tried both with my site and nothing works, i see the point of your idea, but cant fix it, so that it works, what else did u try?

    http://mosign.net

    thanks so much, mo

  7. benutzerfreund
    Member
    Posted 3 months ago #

    Hi mo,

    thanks for pointing this out. It used to work, but since it is a hack, it apparently broke with some of the changes or updates that happened meanwhile.

    What fixed it for me now was removing the said code again from footer.php. I know this is odd, and I have no idea what exactly is happening here.

    To make things even more mysterious: there is a single page where it still is broken:
    http://www.benutzerfreun.de/buch-info/

    Maybe one of the experienced developers around here got any idea? Probably you should start your own thread to get noticed by them.

    Please let me know you you can bring any light to this issue!

    Thanks,
    Jens

  8. mosign
    Member
    Posted 3 months ago #

    hi jens,

    thanks for your help during easter, i tried several things in the meantime and finally solved it! i had another JS in the second widget, had to delete it, now the menu AND the widget are working fine, pooh, im so happy!

    by the way: your buch-info is working perfect for me, did you try one more time?

    liebe gruesse aus wien, mo

  9. benutzerfreund
    Member
    Posted 3 months ago #

    Hi mo,

    Thanks for the update. My conclusion for anyone with this problem: Check your source code and look for JS which is included twice.

    I did not change anything on my site, probably it was an issue with my caching PlugIn…

    Cheers & thanks again for pointing me to this problem on my site,
    Jens

Reply

You must log in to post.

About this Theme

About this Topic

Tags