<?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: Dismiss pop-up on bottom of the page? in Lead Capture Tools</title>
    <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/355214#M4404</link>
    <description>&lt;P&gt;Thanks for the tag&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/21301"&gt;@sharonlicari&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/134321"&gt;@JeroenPuper&lt;/a&gt;,&amp;nbsp;if you want to hide a popup when the user scrolls near the bottom of the page, you can use this code (also re-shows the popup when the user scrolls back up). Our HS popup has ids that start with "leadinModal" so this should work for all HS popups, but you can change the id/class if you need to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//scroll event&lt;BR /&gt;window.onscroll = function(e) {&lt;BR /&gt;  // if the user scrolls near the bottom of the page (bottom of the page minus the height the of window)
  if ((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight)) {
    // display none on the popup. change id/class if appropriate to ('#[id name]') or ('.[class name')&lt;BR /&gt;    $('*[id^="leadinModal"]').css('display','none');
  } else {&lt;BR /&gt;    // re show the popup when the user scrolls back up
    $('*[id^="leadinModal"]').css('display','block');
  }
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a vanilla JS (no jQuery) way of doing the above:&lt;/P&gt;&lt;PRE&gt;// declare styles to be added/removed&lt;BR /&gt;var styles = `
    *[id^="leadinModal"] {
        display: none;
    }
`&lt;BR /&gt;// create the stylesheet and add above styles to it
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
&lt;BR /&gt;// if the user scrolls near the bottom of the page (bottom of the page minus the height the of window)
window.onscroll = function(e) {
  if ((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight)) {
    // add stylesheet&lt;BR /&gt;    document.head.appendChild(styleSheet)
  } else {
    // else remove stylesheet&lt;BR /&gt;    document.head.removeChild(styleSheet)
  }
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: If you want the popup to disappear at the very bottom of the page, instead of near the bottom change&lt;/P&gt;&lt;PRE&gt;((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight))&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;((window.innerHeight + window.scrollY) &amp;gt;= document.body.offsetHeight)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jul 2020 11:03:24 GMT</pubDate>
    <dc:creator>piersg</dc:creator>
    <dc:date>2020-07-17T11:03:24Z</dc:date>
    <item>
      <title>Dismiss pop-up on bottom of the page?</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/354838#M4401</link>
      <description>&lt;P&gt;So I want to add a pop-up to my website asking the visitor to subscribe to our mailing. At the bottom of the page there is a form to submit your email to enter aswell.&amp;nbsp; Two forms with the same goal seems a bit much.&lt;/P&gt;&lt;P&gt;So my question is: can we trigger a dismiss option for the popup when you reach the bottom of the page. Or do you guys have any good suggestions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are pretty keen on keeping the form on the bottom of the page, so just deleting that isn't an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 09:31:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/354838#M4401</guid>
      <dc:creator>JeroenPuper</dc:creator>
      <dc:date>2020-07-16T09:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dismiss pop-up on bottom of the page?</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/355208#M4403</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/134321"&gt;@JeroenPuper&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for the information provided. I'll tag a few experts to see if they can share some examples. &amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/89854"&gt;@Krystina&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/103660"&gt;@piersg&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/9259"&gt;@Mike_Eastwood&lt;/a&gt;&amp;nbsp;&amp;nbsp;could you please share your thoughts with&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/134321"&gt;@JeroenPuper&lt;/a&gt;?&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you&amp;nbsp; &amp;amp; Happy Friday&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sharon&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 10:24:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/355208#M4403</guid>
      <dc:creator>sharonlicari</dc:creator>
      <dc:date>2020-07-17T10:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dismiss pop-up on bottom of the page?</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/355214#M4404</link>
      <description>&lt;P&gt;Thanks for the tag&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/21301"&gt;@sharonlicari&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/134321"&gt;@JeroenPuper&lt;/a&gt;,&amp;nbsp;if you want to hide a popup when the user scrolls near the bottom of the page, you can use this code (also re-shows the popup when the user scrolls back up). Our HS popup has ids that start with "leadinModal" so this should work for all HS popups, but you can change the id/class if you need to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//scroll event&lt;BR /&gt;window.onscroll = function(e) {&lt;BR /&gt;  // if the user scrolls near the bottom of the page (bottom of the page minus the height the of window)
  if ((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight)) {
    // display none on the popup. change id/class if appropriate to ('#[id name]') or ('.[class name')&lt;BR /&gt;    $('*[id^="leadinModal"]').css('display','none');
  } else {&lt;BR /&gt;    // re show the popup when the user scrolls back up
    $('*[id^="leadinModal"]').css('display','block');
  }
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a vanilla JS (no jQuery) way of doing the above:&lt;/P&gt;&lt;PRE&gt;// declare styles to be added/removed&lt;BR /&gt;var styles = `
    *[id^="leadinModal"] {
        display: none;
    }
`&lt;BR /&gt;// create the stylesheet and add above styles to it
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
&lt;BR /&gt;// if the user scrolls near the bottom of the page (bottom of the page minus the height the of window)
window.onscroll = function(e) {
  if ((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight)) {
    // add stylesheet&lt;BR /&gt;    document.head.appendChild(styleSheet)
  } else {
    // else remove stylesheet&lt;BR /&gt;    document.head.removeChild(styleSheet)
  }
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: If you want the popup to disappear at the very bottom of the page, instead of near the bottom change&lt;/P&gt;&lt;PRE&gt;((window.innerHeight + window.scrollY) &amp;gt;= (document.body.offsetHeight - window.innerHeight))&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;((window.innerHeight + window.scrollY) &amp;gt;= document.body.offsetHeight)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 11:03:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/355214#M4404</guid>
      <dc:creator>piersg</dc:creator>
      <dc:date>2020-07-17T11:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dismiss pop-up on bottom of the page?</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/356049#M4408</link>
      <description>&lt;P&gt;Sorry for the late respons, but how do I implement this? If I simply copy the code into the CMS (magento) the pop-up doesn't show up anymore. How can I add this code to the pop-up directly? Or am I doing something wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2020 14:38:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/356049#M4408</guid>
      <dc:creator>JeroenPuper</dc:creator>
      <dc:date>2020-07-21T14:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dismiss pop-up on bottom of the page?</title>
      <link>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/356062#M4409</link>
      <description>&lt;P&gt;I'm not familiar with Magento, but they have some documentation on it &lt;A href="https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/custom_js.html" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first method in &lt;A href="https://magento.stackexchange.com/a/239026" target="_blank" rel="noopener"&gt;this forum message&lt;/A&gt; seems useful and fairly straightforward too.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 08:24:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Lead-Capture-Tools/Dismiss-pop-up-on-bottom-of-the-page/m-p/356062#M4409</guid>
      <dc:creator>piersg</dc:creator>
      <dc:date>2020-07-22T08:24:07Z</dc:date>
    </item>
  </channel>
</rss>

