我已经从 Foundation 4 升级到 Foundation 5,我正在尝试在顶部栏中设置自定义断点而不使用 Sass。
在基础 4 中,您可以更改 foundation.css 文件中的以下 css 代码:
.top-bar-js-breakpoint {
width: 48em !important;
...
}
@media only screen and (min-width: 48em) {
...
}
但这在 Foundation 5 中是不可能的,至少我找不到一段 CSS 或 JS 代码来改变它。
我还尝试重新下载一个新的自定义基础安装,并将 TOP BAR BREAKPOINT
设置为 9999em,但这不起作用。即使在删除所有以前的文件和代码之后。
这个简单的问题让我抓狂,所以如果有人能用一个简单的解决方案来解决我的痛苦就太好了,拜托了!
提前致谢。
最佳答案
在您的代码中找到 meta.foundation-mq-topbar
css 选择器并将 width
属性值更改为 48em 或您想要的任何其他大小。
另一种解决方案: Foundation 将组件媒体查询彼此分开,因此您可以更改每个组件的断点。看这段代码:
@media only screen and (min-width: 40.063em) {
.top-bar {
background: #333333;
*zoom: 1;
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 {
font-size: 0.875rem;
position: relative;
top: 7px; }
.top-bar.expanded {
background: #333333; }
.contain-to-grid .top-bar {
max-width: 62.5em;
margin: 0 auto;
margin-bottom: 0; }
.top-bar-section {
-webkit-transition: none 0 0;
-moz-transition: none 0 0;
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: #272727;
color: white; }
.top-bar-section li a:not(.button) {
padding: 0 15px;
line-height: 45px;
background: #333333; }
.top-bar-section li a:not(.button):hover {
background: #272727; }
.top-bar-section .has-dropdown > a {
padding-right: 35px !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: 22.5px; }
.top-bar-section .has-dropdown.moved {
position: relative; }
.top-bar-section .has-dropdown.moved > .dropdown {
display: none; }
.top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown {
display: block; }
.top-bar-section .has-dropdown .dropdown li.has-dropdown > a:after {
border: none;
content: "\00bb";
top: 1rem;
margin-top: -2px;
right: 5px; }
.top-bar-section .dropdown {
left: 0;
top: auto;
background: transparent;
min-width: 100%; }
.top-bar-section .dropdown li a {
color: white;
line-height: 1;
white-space: nowrap;
padding: 12px 15px;
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 #4d4d4d;
clear: none;
height: 45px;
width: 0; }
.top-bar-section .has-form {
background: #333333;
padding: 0 15px;
height: 45px; }
.top-bar-section ul.right li .dropdown {
left: auto;
right: 0; }
.top-bar-section ul.right li .dropdown li .dropdown {
right: 100%; }
.no-js .top-bar-section ul li:hover > a {
background: #272727;
color: white; }
.no-js .top-bar-section ul li:active > a {
background: #2ba6cb;
color: white; }
.no-js .top-bar-section .has-dropdown:hover > .dropdown {
display: block; }
}
您必须找到上面的代码,并只需更改此媒体查询以更改顶部栏断点。
关于javascript - 顶栏断点 - Foundation 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20218029/