Jump to content

How to make a scrolling text always visible, without space between loops?

Recommended Posts

Posted

Site URL: https://coyote-coconut-z39a.squarespace.com/about

Right now, the scroll bar on my about page (site is here. Password to view is Hello2021) has blank space after the string of text, before it starts it's next rotation. How can I make it so the text is always visible and scrolling, with no blank space?  The code I'm currently using is below.

 <div class="scroll">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW</div>
.scroll{ overflow: hidden!important;
position: relative!important;
 -moz-transform:translateX(100%);
 -webkit-transform:translateX(100%);  
 transform:translateX(100%);
 -moz-animation: scroll 15s linear infinite;
 -webkit-animation: scroll 15s linear infinite;
  animation: scroll 15s linear infinite;}

@-moz-keyframes scroll {
 0%   { -moz-transform: translateX(100%); }
 100% { -moz-transform: translateX(-100%); }

}
@-webkit-keyframes scroll  {
 0%   { -webkit-transform: translateX(100%); }
 100% { -webkit-transform: translateX(-100%); }
}
#page {overflow-x:hidden}

 

  • Replies 3
  • Views 6.4k
  • Created
  • Last Reply
Posted
On 4/6/2021 at 4:33 AM, GinaC123 said:

Site URL: https://coyote-coconut-z39a.squarespace.com/about

Right now, the scroll bar on my about page (site is here. Password to view is Hello2021) has blank space after the string of text, before it starts it's next rotation. How can I make it so the text is always visible and scrolling, with no blank space?  The code I'm currently using is below.


 <div class="scroll">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW</div>

.scroll{ overflow: hidden!important;
position: relative!important;
 -moz-transform:translateX(100%);
 -webkit-transform:translateX(100%);  
 transform:translateX(100%);
 -moz-animation: scroll 15s linear infinite;
 -webkit-animation: scroll 15s linear infinite;
  animation: scroll 15s linear infinite;}

@-moz-keyframes scroll {
 0%   { -moz-transform: translateX(100%); }
 100% { -moz-transform: translateX(-100%); }

}
@-webkit-keyframes scroll  {
 0%   { -webkit-transform: translateX(100%); }
 100% { -webkit-transform: translateX(-100%); }
}
#page {overflow-x:hidden}

 

this may do the trick

<style>
.marquee {
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  white-space: nowrap;
  margin-left: -3vw;
  margin-top: 17px;
}
.marquee-content {
  display: inline-block;
  margin-top: 5px;
  animation: marquee 15s linear infinite;
}
.item-collection-1 {
  position: relative;
  left: 0%;
  animation: swap 15s linear infinite;
}
@keyframes swap {
  0%, 50% {
    left: 0%;
  }
  50.01%,
  100% {
    left: 100%;
  }
}
.marquee-content:hover {
  animation-play-state: paused
}
.item1 {
  display: inline-block;
  height: 70px;
  width: 140px;
  background: cyan;
  vertical-align: top;
  margin-left: 15px;
}
.item2 {
  display: inline-block;
  height: 70px;
  width: 100px;
  background: magenta;
  vertical-align: top;
  margin-left: 15px;
  line-height: 14px;
}
/* Transition */

@keyframes marquee {
  0% {
    transform: translateX(0)
  }
  100% {
    transform: translateX(-100%)
  }
}
</style>
<div class="marquee">
<div class="marquee-content">
    <span class="item-collection-1">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW
    </span>
    <span class="item-collection-2">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW</span>
</div>
</div>

image.png.656ed3d143a173e51395e84b4f5e03f5.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
On 4/8/2021 at 10:09 PM, bangank36 said:

this may do the trick


<style>
.marquee {
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  white-space: nowrap;
  margin-left: -3vw;
  margin-top: 17px;
}
.marquee-content {
  display: inline-block;
  margin-top: 5px;
  animation: marquee 15s linear infinite;
}
.item-collection-1 {
  position: relative;
  left: 0%;
  animation: swap 15s linear infinite;
}
@keyframes swap {
  0%, 50% {
    left: 0%;
  }
  50.01%,
  100% {
    left: 100%;
  }
}
.marquee-content:hover {
  animation-play-state: paused
}
.item1 {
  display: inline-block;
  height: 70px;
  width: 140px;
  background: cyan;
  vertical-align: top;
  margin-left: 15px;
}
.item2 {
  display: inline-block;
  height: 70px;
  width: 100px;
  background: magenta;
  vertical-align: top;
  margin-left: 15px;
  line-height: 14px;
}
/* Transition */

@keyframes marquee {
  0% {
    transform: translateX(0)
  }
  100% {
    transform: translateX(-100%)
  }
}
</style>
<div class="marquee">
<div class="marquee-content">
    <span class="item-collection-1">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW
    </span>
    <span class="item-collection-2">BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW • BOOK NOW</span>
</div>
</div>

image.png.656ed3d143a173e51395e84b4f5e03f5.png

 

That did part of it, except you can see the text jump when it reaches the end of the scroll instead of continuously, smoothly looping. Is there a way to fix that?

Posted
28 minutes ago, GinaC123 said:

 

That did part of it, except you can see the text jump when it reaches the end of the scroll instead of continuously, smoothly looping. Is there a way to fix that?

Use javascript library

https://github.com/aamirafridi/jQuery.Marquee

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.