我需要另一組眼睛,因此感謝您的時間。我有一個基於Zurb基金會的商業模板,它基於頁面的寬度使用jQuery移動幾個元素。我碰到了一個麻煩,可能是因爲對基礎數學的無知,我可以用一隻手。響應式元素不會在768和785像素之間正確堆疊
相關的jQuery的是,在DOC觸發準備和調整大小功能:
function organize() {
var welcome = $('#welcome').remove();
var sidebar = $('#sidebar');
var innerwidth = $('body').innerWidth();
// Move the Welcome DIV - we ALWAYS do this
welcome.appendTo('#content-wrap');
// If we're mobile, let's move a few things around
if(innerwidth < 768) {
if (!sidebar.hasClass('mobile')) {
var sidecut = sidebar.addClass('mobile').detach();
sidecut.prependTo('#content-wrap')
}
}
// If we've gone bigger, put things back where we found them
if(innerwidth >= 768) {
if (sidebar.hasClass('mobile')) {
var sidefix = sidebar.removeClass('mobile').detach();
sidefix.insertAfter('#primary');
}
}
}
正如你所看到的,使用768px破發點,我移動側邊欄頂端而不是底部,否則它將根據源訂單進行堆疊。我也嘗試過document.width,但innerWidth似乎給了額外的容差。儘管休息時間是768,但我一直將CSS問題提高到785,此時一切都解決了。
CSS的相關位的位置(SCSS格式)
// Shop Menu
#shopmenu {
ul {
list-style: none;
margin: 0 0 80px 0;
padding: 0;
@include display;
li {
background: $level-4;
font-size:20px;
border-bottom: 1px solid $level-3;
&:first-child {
padding: 0 10px;
font-size: 22px;
}
&:last-child {border-bottom: none;}
a {
color: rgb(25,25,25);
padding: 0 20px;
&:hover {
text-decoration: underline;
}
}
ul {
margin: 0;
padding: 0;
ul {
padding-left: 25px;
ul {
padding-left: 30px;
ul {
padding-left: 35px;
}
}
}
}
li {
background: $level-4;
font-size:17px;
&:first-child {
padding: 0;
font-size: 20px;
}
a {
padding: 0 30px;
font-size: 16px;
}
li {
border: none;
}
}
}
}
}
而且我並不比調整一些填充,這不是問題,做多與CSS該斷點,其他的(它仍然存在沒有那部分)。這包括檢查了#content-wrap ul.products li的附加斷點,在這裏我改變了%寬度以證明LI based on this technique的正確性。再一次,即使我去了一個沒有風格的清單,問題仍然存在。
希望有人能在我4小時內醒來的時候發現我的derp。
謝謝Ppollono,有+有幫助。然而,在這種情況下,我使用內聯塊,以及0高度100%的寬度元素,以觸發CSS text-align:justify;訂單項中的財產。你可以在這裏閱讀:http://www.barrelny.com/blog/text-align-justify-and-rwd/ – Imperative
感謝分享這篇文章,它打開了我的想法,關於不使用float並停止計算利潤率 – ppollono
樂於分享。你會發現基金會的塊網格幾乎完全相同的原則:http://foundation.zurb.com/docs/components/block_grid.html – Imperative