Search code examples
javascripthtmlwebbuttonfloating

Javascript floating button


helo guys I got some code from my friend, this code is floating button for website, the button is floating on the left bottom corner on the web, but can someone help me to make this button float for example 50px from bottom?

and can we make it without using CSS ??

<script type="text/javascript">
    (function () {
        var options = {
            whatsapp: "+66xx", // WhatsApp number
            telegram: "@somethingxxx", // Telegram bot username
            call_to_action: "My Whatsapp and Tele", // Call to action
            button_color: "#932C8B", // Color of button
            position: "left", // Position may be 'right' or 'left'
            order: "whatsapp,telegram", // Order of buttons
        };
        var proto = document.location.protocol, host = "getbutton.io", url = proto + "//static." + host;
        var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = url + '/widget-send-button/js/init.js';
        s.onload = function () { WhWidgetSendButton.init(host, proto, options); };
        var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
    })();
</script>

Solution

  • Just add this CSS to override default position.

    div#wh-widget-send-button { bottom: 50px !important; }