how to properly replace a hover with off-canvas menu

I have a theme with two toggle menu options (standard and mobile with hover effect).I’m trying to replace the hover with an off-canvas menu solution taking in consideraion this described procedure.

After I’ve updated the css style code using the custom css field option, I’ve uploaded to the server and registered in script-calls.php(instead of calling in footer.php) classie.js and sidebarEffects.js files :

Read More
...
// Main Scripts
function register_js() {

    if (!is_admin()) {
        $url_prefix = is_ssl() ? 'https:' : 'http:';
        // Register 
        wp_register_script('classie', THB_THEME_ROOT . '/assets/js/plugins/classie.js', 'jquery', null, TRUE);            
        wp_register_script('sidebarEffects', THB_THEME_ROOT . '/assets/js/plugins/sidebarEffects.js', 'jquery', null, TRUE);

        // Enqueue
        wp_enqueue_script('classie');
        wp_enqueue_script('sidebarEffects');
        wp_localize_script( 'app', 'themeajax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );
    }
}
...

The original theme mobile menu section in header.php looks like this:

...
<body <?php body_class($class); ?> data-url="<?php echo esc_url(home_url()); ?>" data-cart-count="<?php if($woocommerce) { echo $woocommerce->cart->cart_contents_count; } ?>" data-sharrreurl="<?php echo THB_THEME_ROOT; ?>/inc/sharrre.php">
<div id="wrapper" class="open">

    <!-- Start Mobile Menu -->
    <nav id="mobile-menu">
        <div class="menu-container custom_scroll">
            <a href="#" class="panel-close"></a>
            <div class="menu-holder">
                <?php if ($page_menu) { ?>
                    <?php wp_nav_menu( array( 'menu' => $page_menu, 'depth' => 2, 'container' => false, 'menu_class' => 'mobile-menu sf-menu', 'walker' => new thb_mobileDropdown  ) ); ?>
                <?php } else  if(has_nav_menu('nav-menu')) { ?>
                  <?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 2, 'container' => false, 'menu_class' => 'mobile-menu sf-menu', 'walker' => new thb_mobileDropdown ) ); ?>
                <?php } else { ?>
                    <ul class="mobile-menu">
                        <li><a href="<?php echo get_admin_url().'nav-menus.php'; ?>">Please assign a menu from Appearance -> Menus</a></li>
                    </ul>
                <?php } ?>
            </div>

            <div class="menu-footer">
                <?php echo do_shortcode($menu_footer); ?>
                <?php if (ot_get_option('menu_ls') == 'on') { do_action( 'thb_language_switcher' ); } ?>
            </div>
        </div>
        <div class="spacer"></div>
    </nav>
    <!-- End Mobile Menu -->

    <!-- Start Quick Cart -->
    <?php do_action( 'thb_side_cart' ); ?>
    <!-- End Quick Cart -->

        <!-- Start Loader -->
        <div class="preloader"></div>
        <!-- End Loader -->

        <!-- Start Header -->
        <header class="header row no-padding <?php echo $header_style; ?>" data-equal=">.columns" role="banner">
            <div class="small-7 medium-4 columns logo<?php if ($header_style == 'style1') { ?> show-for-large-up<?php } ?>">
                <?php if ($header_style == 'style2') { ?>
                    <a class="logotext" href="<?php echo esc_url( home_url( '/' ) ); ?>"
                    title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
                    rel="home"><?php bloginfo( 'name' ); ?>
                    </a>
                <?php } ?>
            </div>
            <?php if ($header_style != 'style2') { ?>
            <div class="small-7 medium-4 columns logo">
                <?php if ($header_style == 'style1') { ?>
                    <a class="logotext" href="<?php echo esc_url( home_url( '/' ) ); ?>"
                    title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
                    rel="home"><?php bloginfo( 'name' ); ?>
                    </a>
                <?php } ?>
            </div>
            <?php } ?>
            <div class="small-5 <?php if ($header_style == 'style2') { echo 'medium-8'; } else { echo 'medium-4';} ?> columns menu-holder">
                <?php $full_menu_true = ($menu_mobile_toggle_view == 'style2' && $header_style == 'style2');?>
                <?php if ($full_menu_true) { ?>
                    <nav id="full-menu" role="navigation">
                        <?php if ($page_menu) { ?>
                            <?php wp_nav_menu( array( 'menu' => $page_menu, 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown  ) ); ?>
                        <?php } else  if(has_nav_menu('nav-menu')) { ?>
                          <?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 2, 'container' => false, 'menu_class' => 'full-menu', 'walker' => new thb_mobileDropdown ) ); ?>
                        <?php } else { ?>
                            <ul class="full-menu">
                                <li><a href="<?php echo get_admin_url().'nav-menus.php'; ?>">Please assign a menu from Appearance -> Menus</a></li>
                            </ul>
                        <?php } ?>
                    </nav>
                <?php } ?>
                <?php if ($header_search != 'off') { do_action( 'thb_quick_search' ); } ?>
                <?php if ($header_cart != 'off') { do_action( 'thb_quick_cart' ); } ?>
                <a href="#" data-target="open-menu" class="mobile-toggle<?php if (!$full_menu_true) { ?> always<?php } ?>">
                    <div>
                        <span></span><span></span><span></span>
                    </div>
                </a>
            </div>
        </header>
        <!-- End Header -->
...  

(not so sure if it’s ok), I’ve modified/replaced the above section with:

...
<body <?php body_class($class); ?> data-url="<?php echo esc_url(home_url()); ?>" data-cart-count="<?php if($woocommerce) { echo $woocommerce->cart->cart_contents_count; } ?>" data-sharrreurl="<?php echo THB_THEME_ROOT; ?>/inc/sharrre.php">
<div id="st-container" class="st-container">

    <!-- content push wrapper -->
    <div class="st-pusher">

        <nav class="st-menu st-effect-1" id="menu-1">
            <!-- sidebar content -->
        </nav>
    <div id="st-trigger-effects"><button data-effect="st-effect-3">Menu</button></div>
        <div class="st-content"><!-- this is the wrapper for the content -->
            <div class="st-content-inner"><!-- extra div for emulating position:fixed of the menu -->


    <!-- Start Mobile Menu -->
    <nav id="primary-navigation" class="st-menu st-effect-3" id="menu-3" role="navigation">
            <h1 class="menu-toggle"><?php _e( 'Primary Menu', 'notio-wp' ); ?></h1>
            <a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'notio-wp' ); ?></a>
            <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav>


    <!-- End Mobile Menu -->
... 

Also in footer.php I’ve closed these divs:

...
     </div><!-- /st-content-inner -->
        </div><!-- /st-content -->

    </div><!-- /st-pusher -->

</div><!-- /st-container -->
</body>
</html>

Unfortunately, my result is not functional.The final goal is to obtain the off-canvas menu effect on the right side as alternative to the hover menu, using the existing toggle menu option (between off-side and standard menu), also using the existing burger menu button (when off-canvas is activated). Any thoughts or any other solution with the same effect will be much appreciated.Thanks

Related posts