Nav disappears after resize

安稳与你 提交于 2019-12-12 01:25:30

问题


Site in question: http://www.mtthwbsh.com

I'm building a collapsable nav for this site and have noticed that after it collapses, if you expand and retract it and enlarge the window again the nav disappears. I tried changing the display to block at my media queries but I think the jQuery is overriding it. Any idea what's causing this?

Also, I'd like the arrow to rotate 180 degrees when clicked, how would I target this? My jQuery is as follows:

/* toggle nav */
$("#menu-icon").on("click", function(){
$(".nav").slideToggle();
$(this).toggleClass("active");
});

回答1:


$(".nav").slideToggle(); appears to be leaving the nav in a display:none; state. When you set tried to set the display:block; in your media query did you use !important?

Edit

If your screen size less than 570px needs to be toggled, then you need to make sure that at any size above 570px it will be set in CSS to display:block;

@media (min-width:571px) {
    .nav { display:block!important; }
}

This should adequately override the display property.




回答2:


In style.css, line no. 1015, media queries used for max-width:820px

@media (max-width: 820px)

Check these images, Visible nav, Hidden nav (check css inspector)



来源:https://stackoverflow.com/questions/13983734/nav-disappears-after-resize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!