Skip to content

Instantly share code, notes, and snippets.

@Thijzer
Created November 6, 2015 08:24
Show Gist options
  • Save Thijzer/8b6914afb7af096a795e to your computer and use it in GitHub Desktop.
Save Thijzer/8b6914afb7af096a795e to your computer and use it in GitHub Desktop.
ForkCms cookieBanner
<div class="fullWidthAlert alert" id="cookie-banner" style="display: none;">
<p>{$msgCookieDisclaimer}</p>
<a id="cookie-banner-ok-btn" href="#">{$lblCookieAgree}</a>
</div>
<style>
#cookie-banner {
padding: 8px 15px;
background-color: #fcf8e3;
width: 100%;
color: #c09853;
}
</style>
<script type="text/javascript">
window.onload = function() {
var cookieBanner = $("#cookie-banner");
// if there is no cookiebar we shouldn't do anything
if(cookieBanner.length === 0) return;
var cookieBannerHeight = $(cookieBanner).height();
if(utils.cookies.readCookie('cookie_banner_hide') !== 'b%3A1%3B') {
cookieBanner.show();
}
cookieBanner.on('click', '#cookie-banner-ok-btn', function(e) {
utils.cookies.setCookie('cookie_banner_agree', 'b:1;');
utils.cookies.setCookie('cookie_banner_hide', 'b:1;');
cookieBanner.hide();
});
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment