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

View file

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

View file

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

View file

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