更改Cookie脚本

时间:2017-10-05 13:29:03

标签: javascript html css cookies

我要改变以下cookiescript的了望

    <script type="text/javascript">
    window.cookieconsent_options = {"message":"Meine Website verwendet Cookies um die Benutzerfreundlichkeit zu erhöhen.","dismiss":"Ich stimme zu","learnMore":"More info","link":null};
</script>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/cookieconsent.min.js"></script>

我可以将图像作为按钮而不是文本按钮插入吗?我还需要改变背景颜色和颜色强度。

感谢您的帮助。

约书亚

1 个答案:

答案 0 :(得分:0)

您可以传递自定义布局并执行任何操作:

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/cookieconsent.min.js"></script>

<script type="text/javascript">
    cookieconsent.initialise({
        layout: 'my-cool-layout',
        layouts: {
            'my-cool-layout': '<div class="my-cool-layout">\
            {{ header }}{{ message }}{{ compliance }}{{ pictureOfCat }}</div>{{ close }}',
        },
        elements: {
            pictureOfCat: '<img href="http://placekitten/300/300" />',
        },
        content: {
            header: 'My awesome cat popup!'
        }
    });
</script>

查看库API:https://cookieconsent.insites.com/documentation/javascript-api/

希望有所帮助:)