Foundation Top-Bar不能以特定尺寸工作

时间:2015-06-01 19:50:21

标签: css zurb-foundation

我正在使用Zurbs响应式框架基础。

我决定让顶栏在更大的屏幕上变成汉堡包图标,因为我有很多菜单选项,当他们在平板电脑等中型屏幕上观看网站时,它们会向下推两行。

所以我找到了确定大小的媒体查询

@media only screen and (min-width: 40rem) {...}

我将其更改为1025像素,现在它显示在1025像素及更小的屏幕上。问题是,在较小的屏幕上打开并变大时,实际菜单将无法打开或保持打开状态。

我认为这与某个地方的最大宽度设置有关,但我在该媒体查询中找到的最大宽度并没有改变任何东西。

这是整个查询

@media only screen and (min-width: 1024px) {
  .top-bar {
    background: #333333;
    overflow: visible; }
    .top-bar:before, .top-bar:after {
      content: " ";
      display: table; }
    .top-bar:after {
      clear: both; }
    .top-bar .toggle-topbar {
      display: none; }
    .top-bar .title-area {
      float: left; }
    .top-bar .name h1 a {
      width: auto; }
    .top-bar input,
    .top-bar .button,
    .top-bar button {
      font-size: 0.875rem;
      position: relative;
      height: 1.75rem;
      top: 0.53125rem; }
    .top-bar.expanded {
      background: #333333; }

  .contain-to-grid .top-bar {
    /*max-width: 62.5rem;*/
    margin: 0 auto;
    margin-bottom: 0; }

  .top-bar-section {
    transition: none 0 0;
    left: 0 !important; }
    .top-bar-section ul {
      width: auto;
      height: auto !important;
      display: inline; }
      .top-bar-section ul li {
        float: left; }
        .top-bar-section ul li .js-generated {
          display: none; }
    .top-bar-section li.hover > a:not(.button) {
      background-color: #555555;
      background: #333333;
      color: #FFFFFF; }
    .top-bar-section li:not(.has-form) a:not(.button) {
      padding: 0 0.9375rem;
      line-height: 2.8125rem;
      background: #f68c3b; }
      .top-bar-section li:not(.has-form) a:not(.button):hover {
        background-color: #555555;
        background: pink; }
    .top-bar-section li.active:not(.has-form) a:not(.button) {
      padding: 0 0.9375rem;
      line-height: 2.8125rem;
      color: #FFFFFF;
      background: #008CBA; }
      .top-bar-section li.active:not(.has-form) a:not(.button):hover {
        background: #0078a0;
        color: #FFFFFF; }
    .top-bar-section .has-dropdown > a {
      padding-right: 2.1875rem !important; }
      .top-bar-section .has-dropdown > a:after {
        content: "";
        display: block;
        width: 0;
        height: 0;
        border: inset 5px;
        border-color: rgba(255, 255, 255, 0.4) transparent transparent transparent;
        border-top-style: solid;
        margin-top: -2.5px;
        top: 1.40625rem; }
    .top-bar-section .has-dropdown.moved {
      position: relative; }
      .top-bar-section .has-dropdown.moved > .dropdown {
        display: block;
        position: absolute !important;
        height: 1px;
        width: 1px;
        overflow: hidden;
        clip: rect(1px, 1px, 1px, 1px); }
    .top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown {
      display: block;
      position: static !important;
      height: auto;
      width: auto;
      overflow: visible;
      clip: auto;
      position: absolute !important; }
    .top-bar-section .has-dropdown > a:focus + .dropdown {
      display: block;
      position: static !important;
      height: auto;
      width: auto;
      overflow: visible;
      clip: auto;
      position: absolute !important; }
    .top-bar-section .has-dropdown .dropdown li.has-dropdown > a:after {
      border: none;
      content: "\00bb";
      top: 1rem;
      margin-top: -1px;
      right: 5px;
      line-height: 1.2; }
    .top-bar-section .dropdown {
      left: 0;
      top: auto;
      background: transparent;
      min-width: 100%; }
      .top-bar-section .dropdown li a {
        color: #FFFFFF;
        line-height: 2.8125rem;
        white-space: nowrap;
        padding: 12px 0.9375rem;
        background: #333333; }
      .top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button) {
        color: #FFFFFF;
        background: #333333; }
      .top-bar-section .dropdown li:not(.has-form):not(.active):hover > a:not(.button) {
        color: #FFFFFF;
        background-color: #555555;
        background: #333333; }
      .top-bar-section .dropdown li label {
        white-space: nowrap;
        background: #333333; }
      .top-bar-section .dropdown li .dropdown {
        left: 100%;
        top: 0; }
    .top-bar-section > ul > .divider, .top-bar-section > ul > [role="separator"] {
      border-bottom: none;
      border-top: none;
      border-right: solid 1px #4e4e4e;
      clear: none;
      height: 2.8125rem;
      width: 0; }
    .top-bar-section .has-form {
      background: #333333;
      padding: 0 0.9375rem;
      height: 2.8125rem; }
    .top-bar-section .right li .dropdown {
      left: auto;
      right: 0; }
      .top-bar-section .right li .dropdown li .dropdown {
        right: 100%; }
    .top-bar-section .left li .dropdown {
      right: auto;
      left: 0; }
      .top-bar-section .left li .dropdown li .dropdown {
        left: 100%; }

  .no-js .top-bar-section ul li:hover > a {
    background-color: #555555;
    background: #333333;
    color: #FFFFFF; }
  .no-js .top-bar-section ul li:active > a {
    background: #008CBA;
    color: #FFFFFF; }
  .no-js .top-bar-section .has-dropdown:hover > .dropdown {
    display: block;
    position: static !important;
    height: auto;
    width: auto;
    overflow: visible;
    clip: auto;
    position: absolute !important; }
  .no-js .top-bar-section .has-dropdown > a:focus + .dropdown {
    display: block;
    position: static !important;
    height: auto;
    width: auto;
    overflow: visible;
    clip: auto;
    position: absolute !important; } }

2 个答案:

答案 0 :(得分:0)

您不必“破解”Tob Bar css以在某些断点上显示移动布局。您所要做的就是编辑现有的Foundation设置css文件。

因此,例如,Top Bar有一组可用的SCSS变量,你可以在这里查看它们 - follow the instructions

您正在寻找的是:

#include <iostream>
#include <iomanip>
#include <chrono>
#ifdef WIN32
#define localtime_r(_Time, _Tm) localtime_s(_Tm, _Time)
#endif

int main()
{
    tm localTime;
    std::chrono::system_clock::time_point t = std::chrono::system_clock::now();
    time_t now = std::chrono::system_clock::to_time_t(t);
    localtime_r(&now, &localTime);

    const std::chrono::duration<double> tse = t.time_since_epoch();
    std::chrono::seconds::rep milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(tse).count() % 1000;

    std::cout << (1900 + localTime.tm_year) << '-'
        << std::setfill('0') << std::setw(2) << (localTime.tm_mon + 1) << '-'
        << std::setfill('0') << std::setw(2) << localTime.tm_mday << ' '
        << std::setfill('0') << std::setw(2) << localTime.tm_hour << ':'
        << std::setfill('0') << std::setw(2) << localTime.tm_min << ':'
        << std::setfill('0') << std::setw(2) << localTime.tm_sec << '.'
        << std::setfill('0') << std::setw(3) << milliseconds
        << std::endl;
}

答案 1 :(得分:0)

如果您仅使用CSS下载,则可以在2个位置更改CSS更改顶部断点。这是发布回答的链接

http://foundation.zurb.com/forum/posts/1053-changing-topbar-breakpoint-using-css