This is a web component for viewing zines digitally. It is built with HTML, CSS, and JavaScript and consumes image urls for the front and back of each page. You can see more examples of how it’s used on the Zines page.
How it works
The component can be given a sheet image url and it will slice and rotate accordingly. This is currently limited to letter-sized zines with 8 pages. Images/pages can also be added individually so you can make a large book with many pages.
I chose a web component because it’s a simple way to add a zine viewer to any page without having to use a framework. It’s also a good way to learn about web components and how they work. Hopefully this will allow it to be used im more places or cna be built upon by others.
Upcoming features
I’m looking to add support for html pages and more complex layouts. This can help turn a zine into a more interactive experience. I would also like to support different layouts and sizes for the sheet url so individual pages don’t need to be specified.
What it looks like
How to use it
Use the zine-web-component element in your HTML.
Add the script to the head of your page**.**
<script type="module" src="https://unpkg.com/@joelmturner/zine-viewer-web-component?module"></script>Sheet URL
If your zine is a letter-sized zine with 8 pages and laid out like the image below, you can add the sheet attribute to the zine-viewer element and set it to your sheet URL. The component will slice and rotate the pages correctly.

<zine-viewer sheet="https://res.cloudinary.com/joelmturner/image/upload/v1794247159/Posts/One_Sheet_Sixteen_Page_Eighth_Size_Template.jpg"></zine-viewer>Individually
Add an element with the img-src and back-img-src attributes for each page of the zine. There are two ways to do this:
- Add an element with the
pagesattribute set to a JSON string of the pages.
const pages = [ { "img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/FRONT.jpg", "back-img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/1.jpg", }, { "img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/2.jpg", "back-img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/3.jpg", }, { "img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/4.jpg", "back-img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/5.jpg", }, { "img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/6.jpg", "back-img-src": "https://res.cloudinary.com/joelmturner/image/upload/v1736665494/zines/pick%20me%20ups/BACK.jpg", },];document .getElementById("zine-viewer") ?.setAttribute("pages", JSON.stringify(pages));- Add multiple elements with the
img-srcandback-img-srcattributes for each page of the zine.
<zine-viewer id="zine-viewer"> <div img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_1.jpg" back-img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_2.jpg" ></div> <div img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_3.jpg" back-img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_4.jpg" ></div> <div img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_5.jpg" back-img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_6.jpg" ></div> <div img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_7.jpg" back-img-src="https://res.cloudinary.com/joelmturner/image/upload/v1744579528/zines/unicorn%20zine/unicorn_8.jpg" ></div></zine-viewer>Aspect ratio
This component can render different aspect ratios using the size attribute.
<zine-viewer size="square" > <div img-src="https://placeholdit.com/250x250/dddddd/999999" back-img-src="https://placeholdit.com/250x250/dddddd/999999" ></div> <div img-src="https://placeholdit.com/250x250/dddddd/999999" back-img-src="https://placeholdit.com/250x250/dddddd/999999" ></div> <div img-src="https://placeholdit.com/250x250/dddddd/999999" back-img-src="https://placeholdit.com/250x250/dddddd/999999" ></div></zine-viewer>