Reveal hidden submenus on page load - Twenty Fifteen theme

How can I reveal hidden submenus on the page load in the Twenty Fifteen theme? I would like it so that all the submenus are open on every page. Can someone please guide me on how this can be achieved? Thanks

Topic theme-twenty-fifteen dropdown sub-menu menus Wordpress

Category Web


Figured it out! Use the following PHP code.

/*
 * Toggles the menu dropdowns to open state
*/
function mod_toggle_menus() {
    ?>
    <script type='text/javascript'>
    jQuery(document).ready( function() {

        /* add toggled-on class to submenus */
        jQuery('.sub-menu').addClass('toggled-on');

    });
    </script>
    <?php
}
add_action('wp_footer' , 'mod_toggle_menus');

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.