jquery - 断点后菜单栏失去响应

标签 jquery css drop-down-menu responsive-design navigation

当浏览器窗口大小小于 900 像素时,菜单栏未正确调整大小。
栏仍然太宽,一些内容不在屏幕上,并且还会出现水平滚动条。

我试图让这个菜单栏工作两天。我什至不能指出问题所在。我尝试了所有想到的方法。

我想错误是在

@media screen and (min-width:900px) 

here is a pen with all the code because I thought it's too much code to paste here

最佳答案

您可以使用 flexbox-wrap 将每个元素添加到其余元素下方,如果空间太小,这会将元素移至新行

.site-nav>ul {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  flex-wrap:wrap;
}

codepen

您还可以在菜单顶部添加边距,以防止仅在小型设备上溢出

@media (max-width :800px){
  .site-nav {
    z-index: 999999999999999999;
    margin-top: 25px;
  }

关于jquery - 断点后菜单栏失去响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46220018/

相关文章:

JQuery 删除标签复选框

javascript - 更改 jQuery 元素的属性

html - img 元素上的过渡导致尺寸改变或移动

html - css 定位在父项下下拉

javascript - jQuery 将图像附加到 div 动画

jquery - 使用jquery计算每行的数量价格和总计

javascript - 使用不同深浅的颜色更改背景颜色

html - 我无法用 <li> 删除边距

javascript - php中两个相互关联的下拉列表

c# - 在razor View中设置分页页面大小DropDownList