Mar 19, 20248:14 AM - edited Mar 19, 20248:15 AM
Participant
On Click module load
SOLVE
Hi, When URL is hit in that case I don't want embedded Youtube video to load simultaneously when the page loads.
So I was thinking of creating a Module in such a way that when clicked on div then we could load the YouTube video on a pop-up or could replace the existing div with youtube embedded div.
the main objective is not to load the embedded YouTube code when the page is loading in order to load the page faster.
Yes, that is possible. You can create a module in HubSpot that triggers a popup when an element is clicked and only then the iframe would be loaded into the popup.
Basic HTML for this that includes the trigger and the popup:
<!-- the button is the trigger here but you can update it to be a div, as long as it has the appropriate ID -->
<button id="openModal">Open Modal</button>
<!-- the popup -->
<div id="popupModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<div id="videoContainer"></div>
</div>
</div>
Some basic CSS to style the popup so that it's centered and has a close button:
Yes, that is possible. You can create a module in HubSpot that triggers a popup when an element is clicked and only then the iframe would be loaded into the popup.
Basic HTML for this that includes the trigger and the popup:
<!-- the button is the trigger here but you can update it to be a div, as long as it has the appropriate ID -->
<button id="openModal">Open Modal</button>
<!-- the popup -->
<div id="popupModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<div id="videoContainer"></div>
</div>
</div>
Some basic CSS to style the popup so that it's centered and has a close button: