+ {# Make Gallery Three Wide and add padding arround it. #}
+ {# Make sure the gallery overlay takes up the entire screen and sites on top of evenrything. #}
background: rgba(0,0,0,.8);
.gallery__overlay .close {
+ {# Center the image and text in one fell swoop. We use translate to ensure the image is always centered. #}
.gallery__image--wrapper {
+ {# Pull the gallery hubdb from hubspot and set it as a variable called gallery. #}
{% set gallery = hubdb_table_rows('677222') %}
+ {# loop over the info and create a linked image with the image url and #}
{% for scimg in gallery %}
- <a class="gallery__image" href="{{ scimg.image.url|replace('/hubfs/','/hs-fs/hubfs/')}}?width=1200" title="{{ scimg.image_description }}">
- <img src="{{ scimg.image.url|replace('/hubfs/','/hs-fs/hubfs/')}}?width=550" width="550" alt="{{ scimg.image_description }}">
+ <a class="gallery__image" href="{{ scimg.image.url }}" title="{{ scimg.image_description }}">
+ <img src="{{ scimg.image.url }}" width="550" alt="{{ scimg.image_description }}">
+{# reqquire_js is to ensure the javascript gets added to the footer #}
+ // If you click the gallery image
$('.gallery__image').on('click', function(e){
+ // dont let the link go anywhere
+ // grab the url of the link clicked as well as the title
var url = $(this).attr('href'),
title = $(this).attr('title');
+ // create and append a image popup with the url and title that we grabed.
$('body').append('<div class="gallery__overlay"><button class="close">close</button><siv class="gallery__image--wrapper"><img src="' + url + '" alt=""><p>' + title + '</p></div></div>');
+ // When you click the close button
$('body').on('click', 'button.close', function(e){
+ // dont let the close button link anywhere
+ // Hide the overlay and then remove it from the DOM.
$('.gallery__overlay').hide('400', function(){