aboutsummaryrefslogtreecommitdiff
path: root/build/gallery
diff options
context:
space:
mode:
authorbt <bt@btxx.org>2024-06-08 13:22:19 -0400
committerbt <bt@btxx.org>2024-06-08 13:22:19 -0400
commitdcfb172704f3afb68a30425029ec834be2883274 (patch)
tree02ac480745db802d7af03f3213a0c568322170e3 /build/gallery
parente146f8a64c793c337999ce316b16ebe5fe6f2dab (diff)
More content porting, on-going markdown changes for lowdown support
Diffstat (limited to 'build/gallery')
-rw-r--r--build/gallery/index.html84
1 files changed, 50 insertions, 34 deletions
diff --git a/build/gallery/index.html b/build/gallery/index.html
index 31c7eaf..bd2c312 100644
--- a/build/gallery/index.html
+++ b/build/gallery/index.html
@@ -1,54 +1,64 @@
<!doctype html>
-<html lang="en" id="top">
+<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>Simplifying the Craigslist Gallery</title>
- <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
- <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
+ <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
+ <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
- <a href="#menu">Menu &darr;</a>
+ <a href="#menu">Menu &darr;</a>
</nav>
<main>
-<h1>Simplifying the Craigslist Gallery</h1>
+<h1 id="simplifying-the-craigslist-gallery">Simplifying the Craigslist Gallery</h1>
+
<p>2022-10-03</p>
+
<p><strong>This article was updated on October 11, 2022</strong></p>
-<p>I'm a big fan of <a href="https://craigslist.org">craigslist.org</a> and the overall UX used throughout their application. My own website is an ever-changing example of "brutalist" or minimalist design, so I'm always inspired by existing web apps out in the wild using the same principles.</p>
+
+<p>I&#8217;m a big fan of <a href="https://craigslist.org">craigslist.org</a> and the overall UX used throughout their application. My own website is an ever-changing example of &#8220;brutalist&#8221; or minimalist design, so I&#8217;m always inspired by existing web apps out in the wild using the same principles.</p>
+
<p>One nitpick I have with the current craigslist design is their approach to image galleries inside their listings. They use a chunk of bloated JavaScript (more than <code>380kB</code> total) to render something as simple as a collection of images. This seems like overkill to me.</p>
-<p><figure>
- <img src="/public/images/craigslist-gallery.webp" alt="Current craigslist.org gallery view">
- <figcaption>The current look of image galleries on craigslist</figcaption>
-</figure></p>
-<h2>Simplifying Things</h2>
-<p>My first suggestion would be to remove JavaScript altogether. We can replicate most of the required features with just HTML &amp; CSS. Let's start with our core HTML structure:</p>
-<h3>HTML</h3>
-<pre><code>&lt;div class=&quot;gallery-wrapper&quot;&gt;
- &lt;div class=&quot;full-size&quot;&gt;
- &lt;a name=&quot;p1&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/100/400&quot; alt=&quot;Picture 1&quot; class=&quot;gallery-item&quot;&gt;&lt;/a&gt;
- &lt;a name=&quot;p2&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/101/400&quot; alt=&quot;Picture 2&quot; class=&quot;gallery-item&quot;&gt;&lt;/a&gt;
- &lt;a name=&quot;p3&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/106/400&quot; alt=&quot;Picture 3&quot; class=&quot;gallery-item&quot;&gt;&lt;/a&gt;
- &lt;/div&gt;
- &lt;div class=&quot;thumbnails&quot;&gt;
- &lt;a href=&quot;#p1&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/100/100&quot; alt=&quot;Picture 1 Thumbnail&quot; class=&quot;thumbnail-1&quot;&gt;&lt;/a&gt;
- &lt;a href=&quot;#p2&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/101/100&quot; alt=&quot;Picture 2 Thumbnail&quot; class=&quot;thumbnail-2&quot;&gt;&lt;/a&gt;
- &lt;a href=&quot;#p3&quot;&gt;&lt;img src=&quot;https://picsum.photos/id/106/100&quot; alt=&quot;Picture 3 Thumbnail&quot; class=&quot;thumbnail-3&quot;&gt;&lt;/a&gt;
- &lt;/div&gt;
-&lt;/div&gt;
+
+<h2 id="simplifying-things">Simplifying Things</h2>
+
+<p>My first suggestion would be to remove JavaScript altogether. We can replicate most of the required features with just HTML &#38; CSS. Let&#8217;s start with our core HTML structure:</p>
+
+<h3 id="html">HTML</h3>
+
+<pre><code>&#60;div class="gallery-wrapper"&#62;
+ &#60;div class="full-size"&#62;
+ &#60;a name="p1"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;100&#47;400" alt="Picture 1" class="gallery-item"&#62;&#60;&#47;a&#62;
+ &#60;a name="p2"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;101&#47;400" alt="Picture 2" class="gallery-item"&#62;&#60;&#47;a&#62;
+ &#60;a name="p3"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;106&#47;400" alt="Picture 3" class="gallery-item"&#62;&#60;&#47;a&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="thumbnails"&#62;
+ &#60;a href="#p1"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;100&#47;100" alt="Picture 1 Thumbnail" class="thumbnail-1"&#62;&#60;&#47;a&#62;
+ &#60;a href="#p2"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;101&#47;100" alt="Picture 2 Thumbnail" class="thumbnail-2"&#62;&#60;&#47;a&#62;
+ &#60;a href="#p3"&#62;&#60;img src="https:&#47;&#47;picsum.photos&#47;id&#47;106&#47;100" alt="Picture 3 Thumbnail" class="thumbnail-3"&#62;&#60;&#47;a&#62;
+ &#60;&#47;div&#62;
+&#60;&#47;div&#62;
</code></pre>
+
<p>Here we are placing the full-size gallery images directly inside a single <code>div.full-size</code> as - you guessed it - <code>img</code> elements. This already helps us avoid the pitfall of building out spaghetti <code>div</code> containers.</p>
-<p>Below this parent container we have another element, <code>div.thumbnails</code>, which will be used for our separate, smaller thumbnail versions of our main images. The most important items to note are the associated <code>ahref</code> elements surrounding each <code>img</code> element. By setting the <code>id</code> parameter on our thumbnails to match that of the <code>name</code> on our full-sized images, we can "scroll" the proper image into view without the need for JavaScript.</p>
+
+<p>Below this parent container we have another element, <code>div.thumbnails</code>, which will be used for our separate, smaller thumbnail versions of our main images. The most important items to note are the associated <code>ahref</code> elements surrounding each <code>img</code> element. By setting the <code>id</code> parameter on our thumbnails to match that of the <code>name</code> on our full-sized images, we can &#8220;scroll&#8221; the proper image into view without the need for JavaScript.</p>
+
<p>Now for the <em>fancy</em> stuff - the CSS!</p>
-<h3>CSS</h3>
+
+<h3 id="css">CSS</h3>
+
<pre><code>.gallery-wrapper {
position: relative;
}
.gallery-wrapper:before {
background: rgba(255,255,255,0.8);
- content: &quot;Scroll / Swipe 🡢&quot;;
+ content: "Scroll &#47; Swipe 🡢";
display: block;
padding: 5px;
position: relative;
@@ -64,17 +74,23 @@
.full-size .gallery-item {
scroll-snap-align: start;
}
-</code></pre>
-<pre><code>.thumbnails img {
+
+.thumbnails img {
cursor: pointer;
margin-right: 10px;
}
</code></pre>
-<p>Okay, so it isn't <em>that</em> fancy. It's actually very basic, which is exactly what we were going for. The images are "stacked" inline thanks to the parent container being set to <code>display: flex</code>, even though it has a set width of <code>600px</code>. The included <code>scroll-snap-type: x mandatory</code> tells the browser to allow users to scroll/swipe horizontally through the parent container.</p>
+
+<p>Okay, so it isn&#8217;t <em>that</em> fancy. It&#8217;s actually very basic, which is exactly what we were going for. The images are &#8220;stacked&#8221; inline thanks to the parent container being set to <code>display: flex</code>, even though it has a set width of <code>600px</code>. The included <code>scroll-snap-type: x mandatory</code> tells the browser to allow users to scroll&#47;swipe horizontally through the parent container.</p>
+
<p>The last important piece of this CSS is the <code>scroll-snap-align: start</code> added to the individual image elements. This parameter <em>snaps</em> the next image into the starting position of the parent container on scroll, giving a behavior users have come to expect from media galleries.</p>
-<p>You will also see the included <code>:before</code> pseudo element attached to the main <code>.gallery-wrapper</code> element. This isn't <em>required</em> but it certainly helps from a UX standpoint.</p>
-<h2>Live Demo</h2>
-<p>Check out the embedded CodePen below to see it in action. More functionality could always be built on top of this, such as rendering all images dynamically on "build", but for a starting point I think it's great.</p>
+
+<p>You will also see the included <code>:before</code> pseudo element attached to the main <code>.gallery-wrapper</code> element. This isn&#8217;t <em>required</em> but it certainly helps from a UX standpoint.</p>
+
+<h2 id="live-demo">Live Demo</h2>
+
+<p>Check out the embedded CodePen below to see it in action. More functionality could always be built on top of this, such as rendering all images dynamically on &#8220;build&#8221;, but for a starting point I think it&#8217;s great.</p>
+
<p><a href="https://codepen.io/bradleytaunt/pen/ExLRyXz">Live CodePen Example</a></p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>