网页特效栏目收集了最全最新的前端网页插件,包括最流行的jQuery,Bootstrap,Js,Css,Vue等主流特效插件。
这是一款炫酷时尚、支持多语言、可定制的cookie同意弹框插件,有黑色和白色两种风格,基于JavaScript开发。单击“了解更多”链接,在弹出窗口中显示同意的内容。
功能:
自动语言检测
可配置cookie失效时间
轻松创建自己的风格
使用方法:
1.插入cookieconsent.js文件到HTML文档中
<script src="cookieconsent.js"></script>
2.初始化插件并在页面加载时显示cookie同意弹出窗口。
CookieConsent.run({
"cc_autorun" : true,
"cc_website_name" : "CSSScript",
"cc_website_url" : "CSSScript.com",
"cc_theme_css" : "./src/cookieconsent.css" // path to theme CSS
});
3.使用以下选项可以自定义cookie同意弹出窗口。
CookieConsent.run({
// parent contianer
cc_container : "body",
// auto language detection
cc_auto_language: false,
// or set language here
cc_current_lang : "en",
cc_default_lang : "en",
cc_languages : {},
// auto display on page load
cc_autorun: false,
// // link to your cookie-policy page
cc_policy_url: null,
// delay in ms
cc_delay: 20,
// enable console log
cc_enable_verbose: true,
// 182 days
cc_cookie_expiration : 182,
// cookie name
cc_cookie_name: "cc_cookie",
// if enabled -> erase unused cookies based on deselected preferences
cc_autoclear_cookies: true,
// auto load CSS
cc_autoload_css: true,
// theme css
cc_theme_css: null,
// default class for dark mode
cc_cc_darkmode_class : 'cc_darkmode'
});
4.API方法
// show the cookie consent popup
CookieConsent.show(delay);
// hide the cookie consent popup
CookieConsent.hide();
// clear cookies
CookieConsent.clearCookies();
5.点击按钮显示cookie同意弹出窗口。
<button type="button" data-cc="cc_policy">打开弹窗</button>
转载请注明来源:JavaScript时尚炫酷多语言Cookie同意弹框插件
本文永久链接地址:https://www.moyouyouw.cn/code/675.html
郑重声明:本站所有主题/文章除标明原创外,均来自网络转载,版权归原作者所有,如果有侵犯到您的权益,请联系本站删除,谢谢!我们不承担任何技术及版权问题,且不对任何资源负法律责任。
已有 位小伙伴发表了看法
欢迎 你 发表评论