# Lightbox Video Button

**URL:** <https://community.hubspot.com/t/lightbox-video-button/66377>\
**Category:** CMS Development\
**Created:** [October 3, 2022, 4:17pm UTC](https://community.hubspot.com/t/lightbox-video-button/66377 "2022-10-03T16:17:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GBonner](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@GBonner](https://community.hubspot.com/u/GBonner)\
**Post date:** [October 3, 2022, 4:17pm UTC](https://community.hubspot.com/t/lightbox-video-button/66377/1 "2022-10-03T16:17:27Z")

</div>

Hi all,  
Not a developer but I’m trying to combine two modules, a button that came with a purchased theme and a popup video player i discovered here on the community.

I have managed to get to a point where I can acheive the functionality on a singular button (with a vimeo embed as a module element), but when i add multiple instances of the module it causes issues on the editor page.

Could anyone point me the right direction to be able to add a second button using the functionality that existed on the button module and link it to the URL within the .item as opposed to on a .module basis.

The code I’m using is below:

{% from ‘../../css/\_variables.css’ import sm, md, btn\_focus\_shadow %}  
{% from ‘../../macros/utility.html’ import module\_open\_tag, module\_close\_tag, link\_open\_tag, link\_close\_tag %}  
{% set module\_id = name|replace(‘module\_’, ‘’)|replace(‘widget\_’, ‘’) %}  
\<div class=“inline-items{% if module.wrapper.text\_align.lg %} inline-items--{{ module.wrapper.text\_align.lg }}{% endif %}{% if module.wrapper.text\_align.md %} inline-items--md-{{ module.wrapper.text\_align.md }}{% endif %}{% if module.wrapper.text\_align.sm %} inline-items--sm-{{ module.wrapper.text\_align.sm }}{% endif %}”{% if module.button|length \> 1 %} style=“gap: {{ module.settings.space }}px;”{% endif %}\>  
\<div\>\<div id=“vpop-{{name}}” data-type=“vimeo” data-id=“172052320” data-autoplay=‘true’ \>  
{%- for item in module.button -%}  
{%- if item.type == ‘link’ -%}  
{{ link\_open\_tag(item.link, ‘btn btn--’ ~ item.fill ~ ’ btn--’ ~ item.size ~ ’ btn--’ ~ item.color ~ ’ btn--’ ~ item.shape ~ ’ ’ ~ item.link\_class ~ ’ btn--’ ~ module\_id ~ ‘-’ ~ loop.index, item.link\_onclick) }}  
{% if item.add\_icon and item.icon.icon.name %}  
\<span class=“btn\_\_icon btn\_\_icon–{{ item.icon.icon\_position }}”\>  
{% icon name=‘{{ item.icon.icon.name }}’ style=‘{{ item.icon.icon.type or item.icon.icon.style }}’ unicode=‘{{ item.icon.icon.unicode }}’ icon\_set=‘{{ item.icon.icon.icon\_set }}’ no\_wrapper=True %}  
\</span\>  
\<style\>  
.btn--{{ module\_id }}-{{ loop.index }} .btn\_\_icon svg {  
width: {{ (item.icon.icon\_size / 100)|round(2) }}em;  
}  
\</style\>  
{% endif %}  
{{ item.text }}  
{{ link\_close\_tag(item.link) }}  
{%- if item.color == ‘custom-gradient’ -%}  
\<style\>  
.btn--{{ module\_id }}-{{ loop.index }}.btn--outline {  
border-color: {{ item.gradient\_fallback.color }};  
color: {{ item.gradient\_fallback.color }};  
}  
.btn--{{ module\_id }}-{{ loop.index }}.btn--fill,  
.btn--{{ module\_id }}-{{ loop.index }}.btn--outline:hover {  
background: {{ ‘linear-gradient(111.02deg, ‘~ item.gradient\_start.color ~’ 0%, ‘~ item.gradient\_end.color ~’ 100%)’ }};  
color: {{ item.text\_color.color }};  
}  
.btn--{{ module\_id }}-{{ loop.index }}:focus-visible:not(:hover):not(:active) {  
box-shadow: {{ btn\_focus\_shadow }} rgba({{ item.gradient\_fallback.color|default(‘#000000’)|convert\_rgb }}, .15);  
}  
\</style\>  
{%- elif item.color == ‘custom-color’ -%}  
\<style\>  
.btn--{{ module\_id }}-{{ loop.index }}.btn--outline {  
border-color: {{ item.solid\_color.color }};  
color: {{ item.solid\_color.color }};  
}  
.btn--{{ module\_id }}-{{ loop.index }}.btn--fill,  
.btn--{{ module\_id }}-{{ loop.index }}.btn--outline:hover {  
background: {{ item.solid\_color.color }};  
color: {{ item.text\_color.color }};  
}  
.btn--{{ module\_id }}-{{ loop.index }}:focus-visible:not(:hover):not(:active) {  
box-shadow: {{ btn\_focus\_shadow }} rgba({{ item.solid\_color.color|default(‘#000000’)|convert\_rgb }}, .15);  
}  
\</style\>  
{%- endif -%}  
{%- else -%}  
{%- cta guid=‘{{ item.cta }}’, no\_wrapper=True -%}  
{%- endif -%}  
{%- endfor -%}

\</div\>\</div\>  
\<div class=“video-popup-overlay”\>\</div\>

\<div class=“video-popup-container”\>  
\<div class=“video-popup-close”\> ✖ \</div\>  
\<div class=“video-popup-iframe-container”\>  
\<iframe class=“video-popup-iframe” src=“” width=“100%” height=“100%” frameborder=“0” allow=autoplay\>\</iframe\>  
\</div\>  
\</div\>  
\</div\>  
{% require\_js %}  
\<script\>  
$(“#vpop-{{name}}”).on(‘click’, function(e) {  
e.preventDefault();  
$(“.video-popup-overlay,.video-popup-iframe-container,.video-popup-container,.video-popup-close”).show();  
var srchref=‘’,autoplay=‘’,id=$(this).data(‘id’);  
if($(this).data(‘type’) == ‘vimeo’) var srchref= “{{ module.url\_vimeo.href }}”  
else if($(this).data(‘type’) == ‘youtube’) var srchref=“[YouTube](https://www.youtube.com/embed/)”;  
if($(this).data(‘autoplay’) == true) autoplay = ‘?autoplay=1’;  
$(“.video-popup-iframe”).attr(‘src’, srchref+id+autoplay);  
$(“.video-popup-iframe”).on(‘load’, function() {  
$(“.video-popup-container”).show();  
});  
});

$(“.video-popup-close, .video-popup-overlay”).on(‘click’, function(e) {  
$(“.video-popup-iframe-container,.video-popup-container,.video-popup-close,.video-popup-overlay”).hide();  
$(“.video-popup-iframe”).attr(‘src’, ‘’);  
});  
\</script\>  
{% end\_require\_js %}

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 4, 2022, 9:11pm UTC](https://community.hubspot.com/t/lightbox-video-button/66377/2 "2022-10-04T21:11:43Z")

</div>

Hi, @GBonner 👋 Can you include a few additional details, please? What is the theme? And can you link to the pop-up video player you mentioned? It may be that this isn’t possible or needs a different approach. Or, hopefully, a community member will have some insight for us.

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![GBonner](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@GBonner](https://community.hubspot.com/u/GBonner)\
**Post date:** [October 5, 2022, 10:31am UTC](https://community.hubspot.com/t/lightbox-video-button/66377/3 "2022-10-05T10:31:18Z")

</div>

The Theme is Act3 by Neambo.  
I go the code from a community discussion which I cannot locate.

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [October 7, 2022, 9:37pm UTC](https://community.hubspot.com/t/lightbox-video-button/66377/4 "2022-10-07T21:37:49Z")

</div>

@GBonner the way you have it coded, the javascript can only work on one button on the page. If you want this customization, I suggest reaching out to Neambo directly for help. Otherwise, you would need to hire a developer to do this, it’s not quite as simple as just combining code if you need multiple instances on the same page.
