Jump to content

[Share] Add a Dropdown to Announcement Bar

Recommended Posts

Posted

If it doesn't work, you can send site url, I will check again.

To add a dropdown to announcement bar, you can follow these steps.

#1. First, you need to enable Announcement Bar.

image.thumb.png.37e45ad51baa786902bd51a9c42a35c7.png

#2. Next, you can add a dropdown to Main Navigation

image.png.b242642e85c6f7b3442d8fea9f188b69.png

#3. You can place any texts in Name, but in URL, use this URL: /ann-dropdown

image.png.0d674aa8fa605a43c4dd6ba634f08fa0.png

#4. Use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  setTimeout(function(){
            $('div.header-display-desktop div.header-nav-item:has(a[href="/ann-dropdown"])').appendTo('div#announcement-bar-text-inner-id');
         }, 2000);
});
</script>
<style>
div#announcement-bar-text-inner-id {
    display: flex;
    justify-content: center;
    align-items: center;
}
div#announcement-bar-text-inner-id a.header-nav-folder-title:after {
    content: "\e009";
    font-family: 'squarespace-ui-font';
    position: relative;
    top: 2px;
}
div#announcement-bar-text-inner-id .header-nav-folder-content {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
      min-width: 200px;
}
div#announcement-bar-text-inner-id div.header-nav-item {
    position: relative;
    right: -20px;
}
div#announcement-bar-text-inner-id div.header-nav-item:hover .header-nav-folder-content {
    opacity: 1;
}
  .sqs-announcement-bar-dropzone {
    z-index: 9999999999 !important;
}
  div#announcement-bar-text-inner-id div.header-nav-folder-content a {
    color: #000;
}
</style>

image.png.a2a669044e23735ebbfc661a50318fc2.png

#5. Result

image.png.b7c29bfad528d33610deabf890adb233.png

#6. To remove underline + turn dropdown to button, use this code before </style>

div.header-nav-item a[href="/ann-dropdown"] {
    background-color: #000;
    color: #fff;
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none !important;
}

image.thumb.png.2e2f978fc9dd1ddae07200ecfb1d118e.png

Result

image.thumb.png.16b46f942646fc83eef29a6e6574332b.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!)

  • Replies 0
  • Views 190
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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.