Jump to content

add button to lock screen page

Recommended Posts

You'll need a Business Subscription or higher and would need to write javascript to do this.

It would also apply to all lock screens on your website and not just some. Are you happy for that to happen?

Work With Me 🖥️💻📱

Please remember to tag me so that I get a notification and respond to your help requests.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me or make requests by buying me a coffee . (Caffeine fuels me to take more requests)

For Squarespace Tips & Tricks, visit @squareskills (Youtube 📺 Tutorials)

For Premium and FREE plugins, visit Squareskills (Plugin Store) 🧩

Some links may be affiliate/referral links.

Link to comment
  • 1 year later...
On 12/28/2021 at 11:49 AM, KwameAndCo said:

You'll need a Business Subscription or higher and would need to write javascript to do this.

It would also apply to all lock screens on your website and not just some. Are you happy for that to happen?

I would actually like to know this as well. I have a business account, and understand that it would be the same on all lock pages. 

Link to comment
On 7/23/2023 at 4:24 AM, AshaG said:

I would actually like to know this as well. I have a business account, and understand that it would be the same on all lock pages. 

Which position? Above or under Password box or?

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
On 7/22/2023 at 10:24 PM, AshaG said:

I would actually like to know this as well. I have a business account, and understand that it would be the same on all lock pages. 

As in how to do it?

On 7/24/2023 at 2:15 AM, tuanphan said:

Which position? Above or under Password box or?

Wherever really. They just need to specify.

Work With Me 🖥️💻📱

Please remember to tag me so that I get a notification and respond to your help requests.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me or make requests by buying me a coffee . (Caffeine fuels me to take more requests)

For Squarespace Tips & Tricks, visit @squareskills (Youtube 📺 Tutorials)

For Premium and FREE plugins, visit Squareskills (Plugin Store) 🧩

Some links may be affiliate/referral links.

Link to comment
Just now, AshaG said:

Yes, I would like to be able to do this.

 

On 7/25/2023 at 6:05 AM, KwameAndCo said:

As in how to do it?

Wherever really. They just need to specify.

Specifically I would like the code that allows me to do this. Thank you so much!

Link to comment
16 hours ago, AshaG said:

 

Specifically I would like the code that allows me to do this. Thank you so much!

Add to Settings > Developer Tools > Code Injection > Lock Page

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
  $('<a class="lock-button" href="https://google.com">Lock Button Text</a>').insertAfter('.password-form');
})
</script>
<style>
 a.lock-button {
    background-color: black;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    position: relative;
    top: 50px;
}
</style>

image.thumb.png.43764ddf10afce8bc11296199513e91d.png

image.png.0474622a9e3e5174886ffb99526df6b0.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
On 7/27/2023 at 9:55 AM, tuanphan said:

Add to Settings > Developer Tools > Code Injection > Lock Page

Nice! You beat me to it bro!

Though I would suggest a pure javascript solution like this, so there's no need for jQuery:

<script>
document.addEventListener('DOMContentLoaded', function() {
    var lockButton = document.createElement('a');
    lockButton.href = '/';
    lockButton.className = 'lock-button sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element';
    lockButton.textContent = 'Home';
    document.querySelector('.password-form').after(lockButton);
});
</script>
<style>
 a.lock-button {
    background-color: black; 
    color: white;
    padding: .6rem 1.2rem;
    border-radius: .5rem;
    text-decoration: none;
    position: relative;
    margin-top: 2rem;
}
</style>

(I pretty much copied your styling).

Alternatively, @AshaG, if you want the whole background clickable try:

<script>
document.addEventListener('DOMContentLoaded', function() {
    var slideLayer = document.querySelector('.sqs-slide-layer.layer-front.full-width-height');
    if (slideLayer) {
        slideLayer.addEventListener('click', function() {
            window.location.href = '/';
        });
    }
});
</script>

I haven't tested it but it should work.

Work With Me 🖥️💻📱

Please remember to tag me so that I get a notification and respond to your help requests.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me or make requests by buying me a coffee . (Caffeine fuels me to take more requests)

For Squarespace Tips & Tricks, visit @squareskills (Youtube 📺 Tutorials)

For Premium and FREE plugins, visit Squareskills (Plugin Store) 🧩

Some links may be affiliate/referral links.

Link to comment
On 7/27/2023 at 4:55 AM, tuanphan said:

Add to Settings > Developer Tools > Code Injection > Lock Page

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
  $('<a class="lock-button" href="https://google.com">Lock Button Text</a>').insertAfter('.password-form');
})
</script>
<style>
 a.lock-button {
    background-color: black;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    position: relative;
    top: 50px;
}
</style>

image.thumb.png.43764ddf10afce8bc11296199513e91d.png

image.png.0474622a9e3e5174886ffb99526df6b0.png

Thank you so much!

Link to comment
On 7/28/2023 at 11:40 AM, KwameAndCo said:

Nice! You beat me to it bro!

Though I would suggest a pure javascript solution like this, so there's no need for jQuery:

<script>
document.addEventListener('DOMContentLoaded', function() {
    var lockButton = document.createElement('a');
    lockButton.href = '/';
    lockButton.className = 'lock-button sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element';
    lockButton.textContent = 'Home';
    document.querySelector('.password-form').after(lockButton);
});
</script>
<style>
 a.lock-button {
    background-color: black; 
    color: white;
    padding: .6rem 1.2rem;
    border-radius: .5rem;
    text-decoration: none;
    position: relative;
    margin-top: 2rem;
}
</style>

(I pretty much copied your styling).

Alternatively, @AshaG, if you want the whole background clickable try:

<script>
document.addEventListener('DOMContentLoaded', function() {
    var slideLayer = document.querySelector('.sqs-slide-layer.layer-front.full-width-height');
    if (slideLayer) {
        slideLayer.addEventListener('click', function() {
            window.location.href = '/';
        });
    }
});
</script>

I haven't tested it but it should work.

Thank you so much!

Link to comment
  • 8 months later...
On 4/13/2024 at 10:15 PM, KevinWalton said:

These are awesome, is there a way to add a Javascript that automatically filled in the password above with a press of the button? This way people don't have to enter in a text-based password, when they can just click a button

When you use a link something like this, it will automatically enter password

(just an example link)

https://tuanphan3.squarespace.com/lottie-loading-one?noredirect&password=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.