Jump to content

How do I add form pop up overlay to scrolling text

Recommended Posts

  • Replies 4
  • Views 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 2 weeks later...
  • 2 months later...

Hi @UBM

You can follow these steps

(1) Add a Section and design your desired layout (we will use code to turn this to popup)

(2) Edit Section > Add a Code Block > Use this code

<div class="scroll-popup"></div>

image.thumb.png.b938ec07624ba7888ce730a2c9455733.png

(3) Add a Scrolling Block

(4) Add this code to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $('.scroll-popup').closest('section.page-section').addClass('scroll-popup');
	$('.marquee-block').click(function(){
    	$('section.scroll-popup').toggleClass('show-lightbox');
      $('body').toggleClass('disable-scroll');
    });
});
</script>
<style>
body:not(.sqs-edit-mode) section.scroll-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 90%;
    z-index: 9999999 !important;
    display: none;
}
  section.scroll-popup.show-lightbox {
   display: block !important;
  }
  body.disable-scroll {overflow: hidden;}
  .marquee-block {cursor: pointer;}
</style>

(The code won't work on Edit Mode)

Demo: https://tuanphan3.squarespace.com/scroll-block-to-popup?noredirect

Pass: abc

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.