Patrickvhnederend Posted March 28 Share Posted March 28 Hi, I'm trying to get a third-party widget to activate with the BOEK NU (book now) button in the header. Unfortunately, I have only been able to link this to a separate booking page with the IN-LINE widget, which is not what I want. The widget should 'slide-in' from the right-hand side of the page. For this, I received the code below. Could somebody help me with this? Regards, Patrick Website: somatichub.nl Pasword: SS2024! <button id="widget-button">Boek nu</button> <script src="https://cdn.jsdelivr.net/npm/appybee-widget"></script> <script> AppyBeeWidget.init({ companyAPIKey: 'f3a4a372f989b69e66e4bfb0a438b0b3', style: 'side', locale: 'nl' }); </script> <script> var button = document.getElementById("widget-button"); button.onclick = function() { AppyBeeWidget.show(); }; </script> Link to comment
Beyondspace Posted March 28 Share Posted March 28 16 minutes ago, Patrickvhnederend said: Hi, I'm trying to get a third-party widget to activate with the BOEK NU (book now) button in the header. Unfortunately, I have only been able to link this to a separate booking page with the IN-LINE widget, which is not what I want. The widget should 'slide-in' from the right-hand side of the page. For this, I received the code below. Could somebody help me with this? Regards, Patrick Website: somatichub.nl Pasword: SS2024! <button id="widget-button">Boek nu</button> <script src="https://cdn.jsdelivr.net/npm/appybee-widget"></script> <script> AppyBeeWidget.init({ companyAPIKey: 'f3a4a372f989b69e66e4bfb0a438b0b3', style: 'side', locale: 'nl' }); </script> <script> var button = document.getElementById("widget-button"); button.onclick = function() { AppyBeeWidget.show(); }; </script> Where are you put these above codes? I check on your home page but can not find them BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 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
Patrickvhnederend Posted March 28 Author Share Posted March 28 57 minutes ago, Beyondspace said: Where are you put these above codes? I check on your home page but can not find them I didn't put it on the home page, as I can't put them as part of the BOEK NU button in the header. Do you want me to make a temp button with this? As long as it is not in the header, it works. Let me know Link to comment
Solution Beyondspace Posted March 28 Solution Share Posted March 28 (edited) 33 minutes ago, Patrickvhnederend said: I didn't put it on the home page, as I can't put them as part of the BOEK NU button in the header. Do you want me to make a temp button with this? As long as it is not in the header, it works. Let me know Try adding to your footer code injection <script src="https://cdn.jsdelivr.net/npm/appybee-widget"></script> <script> AppyBeeWidget.init({ companyAPIKey: 'f3a4a372f989b69e66e4bfb0a438b0b3', style: 'side', locale: 'nl' }); </script> <script> const btns = document.querySelectorAll('header a[href="/book-now"]'); if(btns.length) { btns.forEach(button => { button.onclick = function(e) { AppyBeeWidget.show(); return false; /*preventDefault*/ }; }) } </script> <button id="widget-button">Boek nu</button> on your above code can be removed Edited March 28 by Beyondspace add preventDefault for clicking BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 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
Patrickvhnederend Posted March 28 Author Share Posted March 28 11 minutes ago, Beyondspace said: Try adding to your footer code injection Thanks. I added your code. I slides in, but then loads the BOOK-NOW page, therefore the widget disappears again. Is it possible to not link it to a page, so I can omit the extra booking page? Link to comment
Beyondspace Posted March 28 Share Posted March 28 9 minutes ago, Patrickvhnederend said: Thanks. I added your code. I slides in, but then loads the BOOK-NOW page, therefore the widget disappears again. Is it possible to not link it to a page, so I can omit the extra booking page? I've just updated my code, try again and let me know how it works Patrickvhnederend 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 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
Patrickvhnederend Posted March 28 Author Share Posted March 28 2 minutes ago, Beyondspace said: I've just updated my code, try again and let me know how it works Absolute magician. Thank you so much. This made my Easter! 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