Fix gallery sizing on mobile

This commit is contained in:
Joshua Goins 2023-03-06 22:06:56 -05:00
parent 6acbf97d1a
commit c6a3f5af96
4 changed files with 15 additions and 4 deletions

View file

@ -31,6 +31,10 @@
height: 256px;
width: auto;
}
.grid-sizer, .grid-item {
width: 300px;
}
}
/* mobile devices */
@ -65,6 +69,11 @@
height: auto;
width: 100%;
}
.grid-sizer, .grid-item {
width: 100%;
height: auto;
}
}
body {
@ -231,8 +240,6 @@ figure figcaption {
}
.grid-item {
height: auto;
width: 300px;
margin-bottom: 10px;
border: 1px inset black;
border-radius: 3px;

View file

@ -1,8 +1,8 @@
imagesLoaded(document.querySelector('.grid'), function(instance) {
new Masonry('.grid', {
itemSelector: '.grid-item',
columnWidth: 300,
columnWidth: '.grid-sizer',
fitWidth: true,
gutter: 10
gutter: 10,
});
});

View file

@ -9,6 +9,8 @@
{{ $art := (index site.Data ($.Param "json")) }}
<div class="grid">
<div class="grid-sizer"></div>
{{ range $art.categories }}
{{ $should_include := false }}

View file

@ -1,6 +1,8 @@
{{ $paginator := .Paginate (where .Pages "Type" "art") }}
<div class="grid">
<div class="grid-sizer"></div>
{{ range $paginator.Pages }}
{{ partial "render-art" . }}
{{ end }}