- Download https://github.com/js-cookie/js-cookie/ ... .cookie.js which is a very small script
- Make this script available to your site so it gets uploaded to a directory of your choice, eg "scripts"
Use eg. the FilePublisher Object.
- Create a Sticky Layer (buttom-right, absolute, center) and add (embed) some text and a button
Best you place the SL in a master frame to make it available to all pages. The name in this example is master_frameCookieLayer
Format all items as you like it, like the SL: CSS3 animation: animate-fade-in-up: 0,1000
- Add two events to that button:
onclick: animateCSS3: master_frameCookieLayer: animate-fade-out: 0,500
- Uncheck visibility of the SL in the Object Manager.
This will hide the Sticky Layer not only in WWB but also in the browser when loading. So it is initially not visible !
- In each page you want that the SL could appear, add the following script in the page HTML/inside body tag:
This script adds an event when the particular page is ready and fires the myCookieRead() function in case of.
Code: Select all
- Inside SiteHTML/inside body tag:
Function myCookieRead() checks if the cookie has been set and if not makes the SL visible again.
Code: Select all
Function myCookieSet() sets the cookie for further use. Called if the button has been pressed (accepted)
If you press the "accept" button, the SL will go away and a cookie is set.
On each page your SL has been added, the SL will not show up.
When you delete the cookie from your browser and reload the page, the SL will reappear.
Note: Cookie(s) are stored automatically under the domain name of your site. A site can have more cookies but all of them are collected under the domain name. No extra management is needed.
Adopt all namings, formattings and exiration date ect. according your need.
You can use this method not only for a cookie bar but also for other things