<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom photo gallery module not working in Knowledge Base Tool</title>
    <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1210909#M2201</link>
    <description>&lt;P&gt;Your JavaScript is not plain JavaScript, it's JQuery. If you do not have JQuery included in the module/website then the code is not going to work. This is why you're getting "&lt;SPAN&gt;$ is not defined" because $ is a JQuery specific selector.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HubSpot has a global JQuery option that can be turned on, but it's a rather old version of JQuery as they've stopped support for it:&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/website-pages/include-jquery-across-your-hubspot-pages" target="_blank" rel="noopener"&gt;https://knowledge.hubspot.com/website-pages/include-jquery-across-your-hubspot-pages&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;The video you're referencing is from 7 years ago, at a time when HubSpot had this turned on in portals by default so that's probably why they don't bother mentioning they're using JQuery.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can download JQuery or get CDN here:&amp;nbsp;&lt;A href="https://jquery.com/download/" target="_blank" rel="noopener"&gt;https://jquery.com/download/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Though I'd suggest just updating your code to plain JavaScript instead of adding an entire library for a single module.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Oct 2025 14:59:15 GMT</pubDate>
    <dc:creator>alyssamwilie</dc:creator>
    <dc:date>2025-10-10T14:59:15Z</dc:date>
    <item>
      <title>Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1202929#M2173</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I am working on a photo gallery module and I haven't been able to get it to work. I am very new to coding, so I am struggling to figure out what is wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The video I am using as a guide is fairly old:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=gEV_JPlLXhs" target="_blank"&gt;https://www.youtube.com/watch?v=gEV_JPlLXhs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i thought I replicated it very well except in the JS area. The code is not working - the images are opening in a different browser instead of doing a light box effect like in the video.&lt;/P&gt;&lt;P&gt;Below is my code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;HTML:&lt;/P&gt;&lt;P&gt;&amp;lt;!--654671552--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="gallery"&amp;gt;&lt;BR /&gt;{% set gallery = hubdb_table_rows('654671552') %}&lt;BR /&gt;{% for img in gallery %}&lt;BR /&gt;&amp;lt;a class="gallery_image" href="{{ resize_image_url(img.image.url, 1200, 0, 0) }}" title="{{ img.description }}"&amp;gt;&lt;BR /&gt;&amp;lt;img src="{{ resize_image_url(img.image.url, 550, 0, 0) }}" alt="{{ img.description }}" &amp;gt;&lt;BR /&gt;&amp;lt;/a&amp;gt;&lt;BR /&gt;{% endfor %}&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CSS:&lt;/P&gt;&lt;P&gt;.gallery {&lt;BR /&gt;columns: 3;&lt;BR /&gt;padding: 2rem;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_image {&lt;BR /&gt;display: block;&lt;BR /&gt;max-width: 100%;&lt;BR /&gt;margin-bottom: 1em;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_image img {&lt;BR /&gt;max-width: 100%;&lt;BR /&gt;display: block;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_overlay {&lt;BR /&gt;position: fixed;&lt;BR /&gt;top: 0;&lt;BR /&gt;width: 100%;&lt;BR /&gt;height: 100%;&lt;BR /&gt;background: rgba (0,0,0,.9);&lt;BR /&gt;z-index: 1000000;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_overlay close {&lt;BR /&gt;position: absolute;&lt;BR /&gt;top: 2em;&lt;BR /&gt;right: 2em;&lt;BR /&gt;background: transparent;&lt;BR /&gt;color: #fff;&lt;BR /&gt;font-size: 1.5em;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_image wrapper {&lt;BR /&gt;position: absolute;&lt;BR /&gt;top: 50%;&lt;BR /&gt;left: 50%;&lt;BR /&gt;transform: translate(-50%, -50%);&lt;BR /&gt;width: 100%;&lt;BR /&gt;max-width: 1200px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery_image wrapper img {&lt;BR /&gt;max-width: 1200px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JS:&lt;/P&gt;&lt;P&gt;$('.gallery_image').on('click', function(e){&lt;BR /&gt;e.preventDefault();&lt;BR /&gt;console.log();&lt;BR /&gt;&lt;BR /&gt;var url = $(this).attr('href'),&lt;BR /&gt;title = $(this).attr('title');&lt;/P&gt;&lt;P&gt;$('body').append('div class"gallery_overlay"&amp;gt;&amp;lt;button class="close"&amp;gt;close&amp;lt;/button&amp;gt;&amp;lt;div class="gallery_image--wrapper"&amp;gt;&amp;lt;img src="' + url + '" alt=""' + title + '"&amp;gt;&amp;lt;p&amp;gt;' + title + '&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;})--&amp;gt;&lt;/P&gt;&lt;P&gt;function closePopup(){&lt;BR /&gt;$('.gallery_overlay').hide('400', function();{&lt;BR /&gt;$(this).remove();&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;$(body).on('click', '.close', function(e){&lt;BR /&gt;closePopup();&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help!&lt;/P&gt;</description>
      <pubDate>Sat, 20 Sep 2025 04:23:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1202929#M2173</guid>
      <dc:creator>JBartemes</dc:creator>
      <dc:date>2025-09-20T04:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203116#M2174</link>
      <description>&lt;P&gt;Fix the broken HTML you’re appending, use the same class names everywhere, clean up the CSS selectors, and correct the small typos in your JavaScript. Once you align those, the lightbox will work instead of sending the image to a new browser tab.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Sep 2025 10:14:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203116#M2174</guid>
      <dc:creator>HBee</dc:creator>
      <dc:date>2025-09-21T10:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203471#M2175</link>
      <description>&lt;P&gt;I'm sorry, this still isn't working for me. I don't see where I made an error.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 15:53:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203471#M2175</guid>
      <dc:creator>JBartemes</dc:creator>
      <dc:date>2025-09-22T15:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203547#M2176</link>
      <description>&lt;P&gt;I did some chat GPT and i found the syntax errors, but the preventDefault is not working. When I console log it, I get an error message that says:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Uncaught ReferenceError: $ is not defined&lt;BR /&gt;at multiform?fileName=Photo%20Gallery&amp;amp;hsPreviewerApp=module&amp;amp;hs_preview_key=cBHDQ4yOM9KNhSyhFLIeHw&amp;amp;isJsModule=false&amp;amp;is_buffered=true&amp;amp;language=en&amp;amp;module_id=242290400956&amp;amp;portalId=46754353&amp;amp;updated=1758567903767&amp;amp;hs-expires=1758571670&amp;amp;hs-signature=AE7aT7waDm_5-gSME08kA1hIJnPxiFAJgw:131:5&lt;BR /&gt;at multiform?fileName=Photo%20Gallery&amp;amp;hsPreviewerApp=module&amp;amp;hs_preview_key=cBHDQ4yOM9KNhSyhFLIeHw&amp;amp;isJsModule=false&amp;amp;is_buffered=true&amp;amp;language=en&amp;amp;module_id=242290400956&amp;amp;portalId=46754353&amp;amp;updated=1758567903767&amp;amp;hs-expires=1758571670&amp;amp;hs-signature=AE7aT7waDm_5-gSME08kA1hIJnPxiFAJgw:150:5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure what this means, as I have copied the code frojm the video exactly.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 19:09:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203547#M2176</guid>
      <dc:creator>JBartemes</dc:creator>
      <dc:date>2025-09-22T19:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203587#M2177</link>
      <description>&lt;P&gt;Hey &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/992879"&gt;@JBartemes&lt;/a&gt;&lt;/SPAN&gt; - thanks for following up here!&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/992957"&gt;@HBee&lt;/a&gt;&lt;/SPAN&gt; - any ongoing thoughts on this last update that may assist with solving for the error?&lt;BR /&gt;&lt;BR /&gt;Shane, Community Manager&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2025 20:22:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1203587#M2177</guid>
      <dc:creator>STierney</dc:creator>
      <dc:date>2025-09-22T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1210909#M2201</link>
      <description>&lt;P&gt;Your JavaScript is not plain JavaScript, it's JQuery. If you do not have JQuery included in the module/website then the code is not going to work. This is why you're getting "&lt;SPAN&gt;$ is not defined" because $ is a JQuery specific selector.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;HubSpot has a global JQuery option that can be turned on, but it's a rather old version of JQuery as they've stopped support for it:&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/website-pages/include-jquery-across-your-hubspot-pages" target="_blank" rel="noopener"&gt;https://knowledge.hubspot.com/website-pages/include-jquery-across-your-hubspot-pages&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;The video you're referencing is from 7 years ago, at a time when HubSpot had this turned on in portals by default so that's probably why they don't bother mentioning they're using JQuery.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can download JQuery or get CDN here:&amp;nbsp;&lt;A href="https://jquery.com/download/" target="_blank" rel="noopener"&gt;https://jquery.com/download/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Though I'd suggest just updating your code to plain JavaScript instead of adding an entire library for a single module.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 14:59:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1210909#M2201</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2025-10-10T14:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom photo gallery module not working</title>
      <link>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1210922#M2202</link>
      <description>&lt;P&gt;Lifesaver! This worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for future users, this is what my code ended up being:&lt;BR /&gt;&lt;BR /&gt;HTML:&lt;/P&gt;&lt;P&gt;&amp;lt;!--654671552--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="gallery"&amp;gt;&lt;BR /&gt;{% set gallery = hubdb_table_rows('654671552') %}&lt;BR /&gt;{% for img in gallery %}&lt;BR /&gt;&amp;lt;a class="gallery__image" href="{{ resize_image_url(img.image.url, 1200,0,0) }}" title="{{ img.image_description }}"&amp;gt;&lt;BR /&gt;&amp;lt;img src="{{ resize_image_url(img.image.url, 550, 0, 0) }}" alt="{{ img.image_description }}" &amp;gt;&lt;BR /&gt;&amp;lt;/a&amp;gt;&lt;BR /&gt;{% endfor %}&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&lt;BR /&gt;CSS:&lt;/P&gt;&lt;P&gt;.gallery {&lt;BR /&gt;column-count: 3;&lt;BR /&gt;padding: 2rem;&lt;BR /&gt;width: 100%;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__image {&lt;BR /&gt;display: block;&lt;BR /&gt;max-width: 100%;&lt;BR /&gt;margin-bottom: 1em;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__image img {&lt;BR /&gt;max-width: 100%;&lt;BR /&gt;display: block;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__overlay {&lt;BR /&gt;position: fixed;&lt;BR /&gt;inset: 0;&lt;BR /&gt;background: rgba(0,0,0,0.8);&lt;BR /&gt;display: flex;&lt;BR /&gt;align-items: center;&lt;BR /&gt;justify-content: center;&lt;BR /&gt;z-index: 999;&lt;BR /&gt;opacity: 1;&lt;BR /&gt;transition: opacity 0.4s;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__overlay .close {&lt;BR /&gt;position: absolute;&lt;BR /&gt;top: 20px;&lt;BR /&gt;right: 20px;&lt;BR /&gt;z-index: 1000;&lt;BR /&gt;background: white;&lt;BR /&gt;color: black;&lt;BR /&gt;border: none;&lt;BR /&gt;padding: 8px 12px;&lt;BR /&gt;cursor: pointer;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__image--wrapper {&lt;BR /&gt;position: absolute;&lt;BR /&gt;top: 50%;&lt;BR /&gt;left: 50%;&lt;BR /&gt;transform: translate(-50%, -50%);&lt;BR /&gt;width: 100%;&lt;BR /&gt;max-width: 1200px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;.gallery__image--wrapper img {&lt;BR /&gt;max-width: 1200px;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JS:&lt;/P&gt;&lt;P&gt;document.querySelectorAll('.gallery__image').forEach(image =&amp;gt; {&lt;BR /&gt;image.addEventListener('click', function (e) {&lt;BR /&gt;e.preventDefault();&lt;/P&gt;&lt;P&gt;const url = this.getAttribute('href');&lt;BR /&gt;const title = this.getAttribute('title');&lt;/P&gt;&lt;P&gt;const overlay = document.createElement('div');&lt;BR /&gt;overlay.classList.add('gallery__overlay');&lt;/P&gt;&lt;P&gt;overlay.innerHTML = `&lt;BR /&gt;&amp;lt;button class="close"&amp;gt;close&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;div class="gallery__image--wrapper"&amp;gt;&lt;BR /&gt;&amp;lt;img src="${url}" alt="${title}"&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;${title}&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;`;&lt;/P&gt;&lt;P&gt;document.body.appendChild(overlay);&lt;BR /&gt;});&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;function closePopup() {&lt;BR /&gt;const overlay = document.querySelector('.gallery__overlay');&lt;BR /&gt;if (overlay) {&lt;BR /&gt;overlay.style.opacity = '0';&lt;BR /&gt;setTimeout(() =&amp;gt; overlay.remove(), 400);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;document.body.addEventListener('click', function (e) {&lt;BR /&gt;if (e.target.matches('.close')) {&lt;BR /&gt;closePopup();&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 15:30:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Knowledge-Base-Tool/Custom-photo-gallery-module-not-working/m-p/1210922#M2202</guid>
      <dc:creator>JBartemes</dc:creator>
      <dc:date>2025-10-10T15:30:18Z</dc:date>
    </item>
  </channel>
</rss>

