Jump to content

Is it possible to add a floating banner on a cart page?

Recommended Posts

Posted

So I've created a floating banner that directs to WhatsApp with the Add block > Code widget. 

However, since the add block feature is not working on the cart page, I'd like to know if there are any ways to add this floating banner (like using JS?) throughout the website, not only on specific pages. 

 

Here's my code for the floating banner

<style>
/* floating banner  */
.fltBanner2 {
	position: fixed;
	right: 30px; /* distance from left(px) */
	top: 630px; /* distance from the top(px) */
	display: inline;
	z-index: 999;
}
</style>


<!-- 전화연락 -->
<a href="https://api.whatsapp.com/message/TJOJYPO7OSXAM1?autoload=1&app_absent=0" class="fltBanner2" target="_blank">
	<img src="https://cdn.imweb.me/upload/S2023092066b5f5a2d5be5/9c424c8d7901e.png" width="70px" height="70px">
</a>

 

image.thumb.png.3a45e068f93301ae919281742e45026f.pngimage.thumb.png.51af3d1ab9feaa5103b1eefeb04f9ee0.png

 

  • Replies 3
  • Views 1k
  • Created
  • Last Reply

Top Posters In This Topic

Posted
2 hours ago, david7u7 said:

where did you insert your code?

@david7u7 I used a code block and inserted the code in the regular pages except the cart and log in where I have a problem adding a code. 

Posted

Use this code to Website > Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$('<a href="https://api.whatsapp.com/message/TJOJYPO7OSXAM1?autoload=1&app_absent=0" class="fltBanner2" target="_blank"><img src="https://cdn.imweb.me/upload/S2023092066b5f5a2d5be5/9c424c8d7901e.png" width="70px" height="70px"></a>').appendTo('body#cart');
});
</script>
<style>
/* floating banner  */
.fltBanner2 {
	position: fixed;
	right: 30px; /* distance from left(px) */
	bottom: 10px; /* distance from the top(px) */
	display: inline;
	z-index: 999;
}
</style>

image.thumb.png.4a315b4cf748abfd54a70a085d82ceb6.png

image.png.3a5da1dc9350c23aa6e5e4419e8b4e98.png

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!)

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.