Jump to content

[SOLVED] Lightbox with child images


Troost
 Share

Recommended Posts

Hiya PW's!

I'm currently busy with a simple portfolio theme for a girlfriend. She asked me for a lightbox, but it won't work out the way as I wanted it... (ofcourse)
I'm using the Lightbox by Lokesh Dhakar https://lokeshdhakar.com/projects/lightbox2/

The structure is:

Home
-  Portfolio
--    Item 1
--    Item 2
--    Item 3

The page echoes the 'werk' field on the item page. Which is one single image. I rendered the next string for text in the PW field.

<a href='{url}' data-lightbox='image' data-title='{title}'><img src='{url}' alt='{description}' class='masonry-content image' /> <div class='hover-text'>$project->title</div> </a>


Here's my code

<div class="row portgallery animated fadeInUp margdown100">	
		<div class="masonry-wrapper">
			<div class="masonry">
				<?php 
				$projects = $portfolio->children("template=portfolioitem, sort=-created");
				foreach ($projects as $project) {
				    if ($project->werk) {
				      echo "<div class='masonry-item animated fadeInUp'>";
				      echo "$project->werk";
				      echo "</div>";
				    }
				  }
				 ?>
			</div> <!-- /masonry -->
		</div> <!-- /masonry wrapper -->
	<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.js"></script>

The images opens in a new windows instead of the lightbox, since I've read the documentation of the Lightbox I can't find where im going wrong.
Also the div hover-text ain't echoing out the $project->title

Can someone help me out?
The goal is to open the images from the home/portfolio page in the lightbox. So that they can navigate trough the images.

Here is a link of the project
https://tinyurl.com/yxhg9xvs

Thanks in advance,
Hugo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...