Convertir una botonera no-responsive en responsive

Contactar con el profesor

functions.php<?php
add_action( 'wp_enqueue_scripts', 'load_custom_scripts' );
function load_custom_scripts() {
    wp_enqueue_script( 'news-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
    wp_enqueue_style( 'dashicons' );
}
 responsive-menu.js
jQuery(function( $ ){

    $("header .genesis-nav-menu, .nav-primary .genesis-nav-menu, .nav-secondary .genesis-nav-menu").addClass("responsive-menu").before('<div class="responsive-menu-icon"></div>');

    $(".responsive-menu-icon").click(function(){
        $(this).next("header .genesis-nav-menu, .nav-primary .genesis-nav-menu, .nav-secondary .genesis-nav-menu").slideToggle();
    });

    $(window).resize(function(){
        if(window.innerWidth > 600) {
            $("header .genesis-nav-menu, .nav-primary .genesis-nav-menu, .nav-secondary .genesis-nav-menu, nav .sub-menu").removeAttr("style");
            $(".responsive-menu > .menu-item").removeClass("menu-open");
        }
    });

    $(".responsive-menu > .menu-item").click(function(event){
        if (event.target !== this)
        return;
            $(this).find(".sub-menu:first").slideToggle(function() {
            $(this).parent().toggleClass("menu-open");
        });
    });

});
style.css
.responsive-menu-icon {
    /*border-bottom: 1px solid #e3e3e3;*/
    float:right; /*Quitar este estilo si quiero que la hamburguesa esté centrada*/
    cursor: pointer;
    display: none;
    margin-bottom: -1px;
    text-align: center;
}

.site-header .responsive-menu-icon {
    border-bottom: none;
}

.responsive-menu-icon::before {
    color: #000;
    content: "\f333";
    display: inline-block;
    font: normal 20px/1 'dashicons';
    margin: 0 auto;
    padding: 10px;
}
.nav-primary .responsive-menu-icon::before {
    color: #fff;
}

@media only screen and (max-width: 600px) {

/* Estos estilos situarán la hamburguesa en la esquina superior derecha
.nav-primary {

    position: absolute;
    top:0;
    right: 0
}
*/


    .genesis-nav-menu.responsive-menu > .menu-item > .sub-menu,
    .genesis-nav-menu.responsive-menu {
        display: none;
    }

    .genesis-nav-menu.responsive-menu .menu-item,
    .responsive-menu-icon {
        display: block;
    }

    .genesis-nav-menu.responsive-menu .menu-item {
        margin: 0;
    }

    .genesis-nav-menu.responsive-menu .menu-item:hover {
        position: static;
    }

    .genesis-nav-menu.responsive-menu li.current-menu-item > a,
    .genesis-nav-menu.responsive-menu .sub-menu li.current-menu-item > a:hover,
    .genesis-nav-menu.responsive-menu li a,
    .genesis-nav-menu.responsive-menu li a:hover {
        background: none;
        border: none;
        color: #000;
        display: block;
        line-height: 1;
        padding: 20px;
        text-transform: none;
    }
    .nav-primary .genesis-nav-menu.responsive-menu li.current-menu-item > a,
    .nav-primary .genesis-nav-menu.responsive-menu .sub-menu li.current-menu-item > a:hover,
    .nav-primary .genesis-nav-menu.responsive-menu li a,
    .nav-primary .genesis-nav-menu.responsive-menu li a:hover {
        color: #fff;
    }

    .genesis-nav-menu.responsive-menu .menu-item-has-children {
        cursor: pointer;
    }

    .genesis-nav-menu.responsive-menu .menu-item-has-children > a {
        margin-right: 60px;
    }

    .genesis-nav-menu.responsive-menu > .menu-item-has-children:before {
        content: "\f132";
        float: right;
        font: normal 16px/1 'dashicons';
        height: 16px;
        padding: 18px 20px;
        right: 0;
        text-align: right;
        z-index: 9999;
    }
    .nav-primary .genesis-nav-menu.responsive-menu > .menu-item-has-children:before {
        color: #fff;
    }

    .genesis-nav-menu.responsive-menu .menu-open.menu-item-has-children:before {
        content: "\f460";
    }

    .genesis-nav-menu.responsive-menu .sub-menu {
        background-color: rgba(0, 0, 0, 0.05);
        border: none;
        left: auto;
        opacity: 1;
        position: relative;
        -moz-transition:    opacity .4s ease-in-out;
        -ms-transition:     opacity .4s ease-in-out;
        -o-transition:      opacity .4s ease-in-out;
        -webkit-transition: opacity .4s ease-in-out;
        transition:         opacity .4s ease-in-out;
        width: 100%;
        z-index: 99;
    }

    .genesis-nav-menu.responsive-menu .sub-menu .sub-menu {
        margin: 0;
    }

    .genesis-nav-menu.responsive-menu .sub-menu li a,
    .genesis-nav-menu.responsive-menu .sub-menu li a:hover {
        background: none;
        border: none;
        padding: 20px;
        position: relative;
        text-transform: none;
        width: 100%;
    }

}
← Mostrar los resultados de búsqueda incluyendo sólo texto, no diseño o fotos
Convertir una botonera no-responsive en responsive →

Aviso Legal | Política de privacidad