Javascript 浮动按钮

Javascript floating button

嘿伙计们我从朋友那里得到了一些代码,这段代码是网站的浮动按钮,按钮浮动在网页的左下角,但是有人可以帮我让这个按钮浮动例如 50px 来自底部?

我们可以不使用 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>

首先你需要select你的按钮

然后应用 css

CSS:

.button {
    position: fixed;
    bottom: 50px;
    left: 50px;   
}

只需添加此 CSS 即可覆盖默认位置。

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