Jump to content

[Share] Adding an image to Mobile Menu Overlay

Recommended Posts

Some code to add an image (clickable and non-clickable) Mobile Menu Overlay.

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

#1. Add a non-clickable image to the mobile menu overlay

You can use this code to Custom CSS box. Replace Pixabay with your desired image url

[data-folder="root"] .header-menu-nav-wrapper:before {
    content: "";
    background-image: url(https://cdn.pixabay.com/photo/2018/07/10/21/53/tournament-3529744_1280.jpg);
    display: block;
    width: 200px;
    height: 150px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 auto;
    position: relative;
}

image.png.775f8bd6ccdf844d9f049284c58eaf4f.png

Result

image.png.590a18f049df0ecb536ccabef2e1c31b.png

#2. Add a clickable image to the mobile menu overlay

Use this code to Code Injection > Footer

<script src="https://assets.squarewebsites.org/lazy-summaries/lazy-summaries.min.js"></script>
<script>
$(document).ready(function(){
    $('<a class="custom-img" href="https://squarespace.com"><img src="https://cdn.pixabay.com/photo/2018/07/10/21/53/tournament-3529744_1280.jpg"/>').insertBefore('.header-menu-nav-wrapper');
});
</script>
<style>
a.custom-img img {
    width: 250px;
    padding-left: 6vw;
    margin-left: 4vw;
}
</style>

image.png.598596472612bb5a3aad52ec4f9081d8.png

Result

image.png.3e926c92c621722c19eabbc3ff490c35.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!)

Link to comment
  • Replies 0
  • Views 423
  • 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.