Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <base href="https://raw-dot-custom-elements.appspot.com/Scarygami/scary-cookie-consent/2.0.0/scary-cookie-consent/">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="scary-cookie-consent.html">

<style>
  scary-cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    --cookie-consent-color: white;
    --cookie-consent-background: black;
  }
</style>

<dom-bind>
  <template>
    <div hidden$="[[!consent]]">
      <p>Any content that relies on cookies (like social media plugins) can be added in here.</p><br>

      <button onclick="revokeConsent()">Revoke consent</button>
    </div>

    <p>General content that will be visible to everyone no matter if consent has been given or not.</p><br>

    <div hidden$="[[consent]]">
      <p>Special content that will only be shown to people who haven't given consent (yet).</p><br>
    </div>

    <br><br>
    <a href="demo_policy.html">Cookie policy</a>

    <scary-cookie-consent id="cookie" cookiePath="/" consent="{{consent}}" policy="demo_policy.html">
      This website uses cookies to improve your user experience and we need your consent to store those cookies on your computer.
    </scary-cookie-consent>
  </template>
</dom-bind>

<script>
  var cookieConsent = null;



  function onConsentGiven() {
    console.log('Consent given! Any scripts that depend on cookies can be run now.');
  }

  function revokeConsent() {
    cookieConsent.revoke();
  }

  function onConsentRevoked() {
    console.log('Consent revoked! All cookies we created have to be deleted now.');
  }

  window.addEventListener('WebComponentsReady', function(e) { 
    cookieConsent = document.querySelector("#cookie");
    cookieConsent.addEventListener("consent-given", onConsentGiven);
    cookieConsent.addEventListener("consent-revoked", onConsentRevoked);
  });

</script>
























<div class="vd-container"><div class="vd"><a target="_blank" href="https://vaadin.com/directory/component/Scarygamiscary-cookie-consent">Check out scary-cookie-consent on Vaadin Directory</a></div></div>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console