Forum
Webflow to Perch endeavor
Hello, I am very new to Perch and trying to plan out my first project to be driven by Perch. The website I am working on is https://alonzoclemons.com
I am a designer first and I am familiar with HTML, CSS and some light JS. That being said I use Webflow to create my web designs and would like to use the code from Webflow to integrate Perch.
Although most of the planning seems straight forward, I have hit a wall on how to deal with the Gallery as the gallery uses a script within the html. Please see the below code example of one of the gallery items.
<div class="w-col w-col-6">
<div class="gallery-div-block pastels">
<a class="w-inline-block w-lightbox" href="#"><img alt="Hippo Mama" src="images/pastel-1-th.jpg">
<script class="w-json" type="application/json">
{ "items": [{
"type": "image",
"_id": "588d535de39b1da106c894ea",
"fileName": "pastel-1.jpg",
"origFileName": "pastel-1.jpg",
"width": 1000,
"height": 659,
"fileSize": 171368,
"url": "images/pastel-1.jpg"
}] }
</script>
</a>
<h3 class="gallery-h3">Pastel 1</h3>
</div>
</div>
What is the best way to to integrate the Gallery App for this with the script?
Thanks in advance.
I would start with a fresh presentation script. Most gallery display ( slider, grids, lightbox ) libraries have well documented methods of injecting images into your page. Your code inserts a single image.
To begin with the gallery you will need to start with a call to the gallery app. The code below uses the Gallery Revolution js and starts with setting up the images on the page using this template.
the Template cycles through list images and has the Slider Reveolution JS Library data sprinkled around the perch gallery image request.
data-* are custom image attributes used by this particular library to manipulate the presentation of the image.
This is just a quick intro intro... and is specific to the Slider Revolution code. You'll need to create your own custom template with the gallery app. The broad principle is just to weave Perch image data and Js presentation data into your templates.
You can create a Perch template to output JSON if you need - it's all just text.
Ok, I will dig into this tonight and create a template for this. Thanks Ian and Drew for the input on this.
I created a template and added the regions to my homepage for the latest works images with lightbox effect.
I was able to add the images for the thumbnail and the larger image for the lightbox but the lightbox is not working with the code I am using.
Here is the original HTML for one of the image cells
Here is my template
I am not sure what I am doing wrong and I feel as thought the embedded script is playing a role in why the lighbox is not triggering. You can see the live site here without perch installed and the lightbox working correctly. https://alonzoclemons.com
Any help on this would be greatly appreciated.
I solved the issue.
I removed the
from this line of code
I also removed this code from the script
Everything is working like intended.