Masonry grid attempt 2.

This commit is contained in:
kor 2018-07-14 22:07:08 +12:00
parent f66c0829c1
commit 2fd8ab3727
2 changed files with 65 additions and 26 deletions

View File

@ -2,28 +2,67 @@ html {
background:#DCDCDC;
font-family:'Monaco', 'Andale Mono', 'Deja Vu Sans Mono', 'Consolas', monospace;
font-size:1em;
box-sizing: border-box;
}
/*#content div:nth-child(4n+1) {
grid-column-end: span 2;
grid-row-end: span 2;
*,
*:before,
*:after {
box-sizing: inherit;
}
#content div:nth-child(2) {
grid-column: 3;
grid-row: 2 / 4;
}
#content div:nth-child(5) {
grid-column: 1 / 3;
grid-row: 1 / 3;
}*/
#content {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-rows: 100px;
grid-gap: 10px;
grid-auto-flow: dense;
/* Masonry */
#masonry {
max-width: 1550px;
min-width: 300px;
column-gap: 1em;
margin-left: 0.75em;
margin-right: 0.75em;
margin-top: 1em;
page-break-inside: avoid;
break-inside: avoid;
}
#item {
background: #fff;
margin-bottom: 1em;
padding: 1em;
display: inline-block;
overflow: hidden;
width: 100% !important;
}
@media only screen and (min-width: 1550px) {
#masonry {
column-count: 5;
}
}
@media only screen and (max-width: 1549px) and (min-width: 1250px) {
#masonry {
column-count: 4;
}
}
@media only screen and (max-width: 1249px) and (min-width: 950px) {
#masonry {
column-count: 3;
}
}
@media only screen and (max-width: 949px) and (min-width: 650px) {
#masonry {
column-count: 2;
}
}
@media only screen and (max-width: 649px) and (min-width: 0px) {
#masonry {
column-count: 1;
}
}
/* LINK */
a {
color:#000;

View File

@ -11,7 +11,7 @@ function Main()
let view = ``;
let html = document.body;
view += `<div id="content">${displayEntries(DB)}</div>`;
view += `<div id="masonry">${displayEntries(DB)}</div>`;
html.innerHTML = view;
}
@ -28,14 +28,14 @@ function displayEntries(db)
value = db[keys[i]];
// ENTRY
var idEntry = "entry";
if (typeof value.REVI !== 'undefined')
{
if (value.REVI == "true")
{
idEntry = "entryImportant";
}
}
var idEntry = "item";
// if (typeof value.REVI !== 'undefined')
// {
// if (value.REVI == "true")
// {
// idEntry = "entryImportant";
// }
// }
entries += `<div id="${idEntry}">`;
entries += `${keys[i].toProperCase()}`;