floater only to appear on certain pages with it's own link

PHOTO EMBED

Wed Jan 22 2025 15:43:38 GMT+0000 (Coordinated Universal Time)

Saved by @Shira

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
    var pageMap = {
        "/en/whale-safari/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1324061",
        "/tumlarsafari/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1324061",
        "/grottvandring/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510420/?full-items=yes&flow=1085497",
        "/en/cavewalk/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510420/?full-items=yes&flow=1085497",
        "/en/rent-a-mountainbike-on-kullaberg/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1089659",
        "/hyr-en-mountainbike-cykla-pa-kullaberg/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1089659",
        "/en/abseiling/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510419/?full-items=yes&flow=1085497",
        "/bergsnedfirning-pa-kullaberg/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510419/?full-items=yes&flow=1085497",
        "/en/coasteering-eng/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510439/?full-items=yes&flow=1085497",
        "/coasteering/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510439/?full-items=yes&flow=1085497",
        "/en/bike-rental/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1324078",
        "/hyrcykel/": "https://fareharbor.com/embeds/book/kullabergsguiderna/?full-items=yes&flow=1324078",
        "/en/treasure-hunt/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510421/?full-items=yes&flow=1085497",
        "/kullamannens-skattjakt/": "https://fareharbor.com/embeds/book/kullabergsguiderna/items/510421/?full-items=yes&flow=1085497"
    };

    // Get the current page path
    var currentPath = window.location.pathname;

    // Check if the current path exists in the pageMap
    if (pageMap[currentPath]) {
        var bookingURL = pageMap[currentPath];

        // Create the desktop button
        var desktopButton = $('<a>', {
            href: bookingURL,
            style: "margin-right: 2em !important; text-decoration:none !important; font-family:'Roboto Condensed', sans-serif !important; font-size:20px !important; font-weight:700 !important; letter-spacing: 1.1px !important;box-shadow:none !important; padding: .15em 2em !important;",
            class: "fh-hide--mobile fh-fixed--bottom fh-icon--cal fh-button-true-flat-color fh-shape--square fh-lang",
            text: "BOKA NU"
        });

        // Create the mobile button
        var mobileButton = $('<a>', {
            href: bookingURL,
            style: "text-decoration:none !important; width: 50% !important; margin: 0 auto !important; font-family:'Roboto Condensed', sans-serif !important; font-size: 1.2em !important; font-weight:bold !important; letter-spacing: 1.1px !important; box-shadow:none !important; text-align: center !important; width: 60% !important;",
            class: "fh-hide--desktop fh-size--small fh-fixed--bottom fh-button-true-flat-color fh-color--white fh-shape--square fh-lang",
            text: "BOKA NU"
        });

        // Append the buttons to the body
        $('body').append(desktopButton).append(mobileButton);

        // Update text to "BOOK NOW" for English pages
        if (currentPath.includes('/en/')) {
            $('a.fh-fixed--bottom').text('BOOK NOW');
        }
    }
});
</script>
content_copyCOPY