<?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 On Click module load in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/On-Click-module-load/m-p/945972#M38394</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;When URL is hit in that case I don't want embedded Youtube video to load &lt;SPAN&gt;simultaneously&amp;nbsp;&lt;/SPAN&gt;when the page loads.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;the main objective is not to load the embedded YouTube code when the page is loading in order to load the page faster.&lt;BR /&gt;&lt;BR /&gt;Is that possible?&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2024 12:15:15 GMT</pubDate>
    <dc:creator>shadow42</dc:creator>
    <dc:date>2024-03-19T12:15:15Z</dc:date>
    <item>
      <title>On Click module load</title>
      <link>https://community.hubspot.com/t5/CMS-Development/On-Click-module-load/m-p/945972#M38394</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;When URL is hit in that case I don't want embedded Youtube video to load &lt;SPAN&gt;simultaneously&amp;nbsp;&lt;/SPAN&gt;when the page loads.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;the main objective is not to load the embedded YouTube code when the page is loading in order to load the page faster.&lt;BR /&gt;&lt;BR /&gt;Is that possible?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 12:15:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/On-Click-module-load/m-p/945972#M38394</guid>
      <dc:creator>shadow42</dc:creator>
      <dc:date>2024-03-19T12:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: On Click module load</title>
      <link>https://community.hubspot.com/t5/CMS-Development/On-Click-module-load/m-p/946161#M38403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/315565"&gt;@shadow42&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basic HTML for this that includes the trigger and the popup:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!-- the button is the trigger here but you can update it to be a div, as long as it has the appropriate ID --&amp;gt;
&amp;lt;button id="openModal"&amp;gt;Open Modal&amp;lt;/button&amp;gt;

&amp;lt;!-- the popup --&amp;gt;
&amp;lt;div id="popupModal" class="modal"&amp;gt;
  &amp;lt;div class="modal-content"&amp;gt;
    &amp;lt;span class="close"&amp;gt;&amp;amp;times;&amp;lt;/span&amp;gt;
    &amp;lt;div id="videoContainer"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some basic CSS to style the popup so that it's centered and has a close button:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  position: absolute;
  background-color: #fefefe;
  padding: 20px;
  border-radius: 10px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the javascript to tie it all together (replace the "VIDEO_ID_HERE" with the actual video ID)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;document.getElementById('openModal').addEventListener('click', function() {
  let modal = document.getElementById('popupModal');
  let videoContainer = document.getElementById('videoContainer');
  
  videoContainer.innerHTML = '&amp;lt;iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID_HERE" frameborder="0" allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;';
  
  modal.style.display = 'block';
  
  document.getElementsByClassName('close')[0].addEventListener('click', function() {
    modal.style.display = 'none';
    videoContainer.innerHTML = '';
  });
});
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 16:12:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/On-Click-module-load/m-p/946161#M38403</guid>
      <dc:creator>evaldas</dc:creator>
      <dc:date>2024-03-19T16:12:41Z</dc:date>
    </item>
  </channel>
</rss>

