Guest Posted February 28, 2021 Share Posted February 28, 2021 Site URL: https://amalfimedia.com/nfc/moroccan-stew Hello, all! I was wondering if anyone knows how to use the window.print() method to a Squarespace button? I’d like for people to have the option to print our recipes without having to send them to a service like printfriendly. I feel like this could be done with markdown or code but I’d really like if it was in a button like the other 3 on the page. Thanks so much! Link to comment
Beyondspace Posted March 1, 2021 Share Posted March 1, 2021 16 hours ago, TheNattyD said: Site URL: https://amalfimedia.com/nfc/moroccan-stew Hello, all! I was wondering if anyone knows how to use the window.print() method to a Squarespace button? I’d like for people to have the option to print our recipes without having to send them to a service like printfriendly. I feel like this could be done with markdown or code but I’d really like if it was in a button like the other 3 on the page. Thanks so much! You gonna need 2 steps to achieve this 1. Add a button with link, something like: "#print-page" 2. Head to Settings->Advanced->Code Inject, paste this to footer <script> $(document).ready(function() { $(document).on("click", "#block-yui_3_17_2_1_1614500466691_13651 .sqs-block-button-element[href='#print-page']", function(e) { e.preventDefault(); window.print() return false; }) }); </script> tuanphan 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment