简体   繁体   English

使导航菜单滑入

[英]Make navigation menu slide in

How would I go about making this menu slide in on hamburger menu click? 我如何才能使此菜单在汉堡菜单单击中滑入? The background of it is an SVG and not an actual shape. 它的背景是SVG,而不是实际形状。

https://codepen.io/KirbStarRulz/pen/GdzOyM https://codepen.io/KirbStarRulz/pen/GdzOyM

$(document).ready(function() {
    $('.hamburger-container').on('click', function(e) {
       e.preventDefault();
       $('.hideMenu').toggleClass('slideInMenu');
    });
});

function myFunction(x) {
    x.classList.toggle("change");
}

Here's an image of what I need slid in (orange trapezoid on the right) https://ibb.co/nRrr1T 这是我需要滑入的图像(右侧的橙色梯形) https://ibb.co/nRrr1T

Thanks! 谢谢!

If I understand correctly you want to slide in navigation. 如果我理解正确,则想在导航中滑动。 Your code works fine the only problem is negative z-index because of it your navigation is below all other elements. 您的代码运行良好,唯一的问题是负z-index,因为它的导航位于所有其他元素之下。

.hideMenu {
    background-image: url(images/kreativez_menu_bg.svg);
    width: 48%;
    height: 100%;
    background-size: cover;
    position: fixed;
    transform: translateX(200%);
    z-index: 100;
    top: 0;
    left: 0;
    transition: transform 0.5s linear;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM