Nicholas Ritson
Nicholas Ritson

Reputation: 909

OffCanvas Menu Foundation 6

Just been working in Wordpress with Foundation 6 and i am building a menu with the off-canvas for mobile. But i seem to have a problem where the content isnt loading into the off-screen menu, below is the code im using, am i putting things in the wrong place? The reason for the outer divs (dragoncove_mobile_menu) is i have media queries to display different menus at different sizes. Which i will list below although i've tried without the queries and there was no change.

<div id="dragoncove_mobile-menu">
<div class="off-canvas-wrapper">
    <div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
        <!-- Create off canvas menu -->
        <div class="off-canvas position-left" id="offCanvas" data-off-canvas></div>
        <!-- Content -->
        <div class="off-canvas-content" data-off-canvas-content>
            <?php dragoncove_mobile_slot_1(); ?>
        </div>
    </div>

    <!-- Button Toggle -->
    <button type="button" class="dragoncove_mobile_button" data-toggle="offCanvas">Open Menu</button>

 </div>

.dragoncove_mobile_button {background: none; border: 2px solid #fff; border-radius: 5px; color: #fff; padding:10px;}

/* Small only */
@media screen and (max-width: 39.9375em) {
#dragoncove_desktop-menu {display: none;}
#dragoncove_mobile-menu {display: inline-block;}
}

/* Medium and up */
@media screen and (min-width: 40em) {
#dragoncove_desktop-menu {display: inline-block;}
#dragoncove_mobile-menu {display: none;}
}
</style>        

<!-- Menu's are registered like this -->
// Dragon Cove Mobile Menu Slot 1
function dragoncove_mobile_slot_1() {
     wp_nav_menu(array(
        'container' => false,                           // Remove nav     container
    'menu_class' => 'vertical menu',       // Adding custom nav class
    'items_wrap' => '<ul id="%1$s" class="%2$s" data-responsive-menu="accordion medium-dropdown">%3$s</ul>',
    'theme_location' => 'dc_mobile_menu_slot1',                 // Where it's located in the theme
    'depth' => 5,                                   // Limit the depth of the nav
    'fallback_cb' => false,                         // Fallback function (see below)
    'walker' => new Topbar_Menu_Walker()
));
}

Upvotes: 0

Views: 478

Answers (1)

Forbairt
Forbairt

Reputation: 11

A quick look at this and it looks like you're misinterpreting how this works

The offcanvas menu area is contained within

<div class="off-canvas position-left" id="offCanvas" data-off-canvas></div>

All the rest of your content should be contained within

<div class="off-canvas-content" data-off-canvas-content>

Upvotes: 1

Related Questions