Giter Club home page Giter Club logo

bootstrap-cookie-alert's Introduction

Bootstrap-Cookie-Alert

A simple cookie alert for Bootstrap 5 and 4. No dependencies required.

Demo with Bootstrap 5 โ€ข Demo with Bootstrap 4

I unfortunately don't remember the source of the cubes pattern :( If someone know, please email me or create an issue. I would love to credit the author.

npm package

npm i bootstrap-cookie-alert

How to use

1. In the head of your document, include cookiealert.css after Bootstrap.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Wruczek/Bootstrap-Cookie-Alert@gh-pages/cookiealert.css">

2. Add the html markup:

<!-- START Bootstrap-Cookie-Alert -->
<div class="alert text-center cookiealert" role="alert">
    <b>Do you like cookies?</b> &#x1F36A; We use cookies to ensure you get the best experience on our website. <a href="https://cookiesandyou.com/" target="_blank">Learn more</a>

    <button type="button" class="btn btn-primary btn-sm acceptcookies">
        I agree
    </button>
</div>
<!-- END Bootstrap-Cookie-Alert -->

3. Include the JavaScript after the html markup

<script src="https://cdn.jsdelivr.net/gh/Wruczek/Bootstrap-Cookie-Alert@gh-pages/cookiealert.js"></script>

Take a look at demo-bs5.html for a working example

Accept event

If you need to, you can listen for the cookieAlertAccept event to get notified when the user accepts the cookies.

window.addEventListener("cookieAlertAccept", function() {
    alert("cookies accepted")
})

bootstrap-cookie-alert's People

Contributors

andileni avatar maxstarkenburg avatar schwebke avatar schyzophrenic avatar wruczek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bootstrap-cookie-alert's Issues

cookiealert-container Unknown CSS class

In your HTML code, this line has a class

that can not be located in the CSS. Is this something missing? It does not seem to matter as the code works just fine.

Orgbrat

"sameSite" Problem

Hi Wruczek,
the plugin is great, but I have a small problem regarding the "sameSite" attribute. In Firefox it says
that the "sameSite" attribute is "none" oder mnot guilty without a "secure"-attribute. Can you help.
regards Alf

Feature request: Semi-standalone version?

Most sites (at least most of my sites) already have jQuery implemented for various other functionality. But they don't have jsCookie.

Would it be possible to make a semi-standalone-version that is dependent on jQuery, but is standalone in regards to jsCookie ...?

Thanks a lot!

Using with Webpack (Encore)

I have used the static version of this little script for a while, thank you for that.
I am trying to move to Webpack (Encore) but facing some challenges.
In my main app.js, I include:
import cookieAlert from 'bootstrap-cookie-alert';
and in the scss: @import "~bootstrap-cookie-alert"; (could be done in the app.js though)

The build fails as the script cannot find the required sources:

SassError: File to import not found or unreadable: ~bootstrap-cookie-alert.
...
>> @import "~bootstrap-cookie-alert";

The js inclusion would also fail with:

 ERROR  Failed to compile with 1 errors                                                                         12:20:53
This dependency was not found:

* bootstrap-cookie-alert in ./assets/js/app.js

To install it, you can run: npm install --save bootstrap-cookie-alert

This issue should be resolved with #17

Issue with the link

The link is alway pointing to https://www.cookiesandyou.com/
I want to the link to point to an internal private policies page, but It keeps pointing to cookie page. Any help would be appreciated. Thanks

Do you like cookies? ๐Ÿช We use cookies to ensure you get the best experience on our website. Learn more I agree

Can we get a callback ?

Can we get a callback function ?

Technically, we are supposed to not use ANY cookies until the user has given consent.
Therefore i need to know when the user clicked on AGREE to load Analytics and other tracking cookies.

Alert doesn't show up in Safari

Hi, thanks a lot for this tool!
I'm using it alongside Bootstrap 3 and AdminLTE 2.

While it does work with Firefox and Chrome, the alert does not show up in Safari (12.1).
The demo does not work either.

Is there any way I could help you with debugging?

Take off banner in scroll

Hi Wruczek,

First thank you very much for your job.

Second. Should be possible to have a little modification to have the cookies accept also if the user scroll the page?

Thanks

Dependencies

Hello,
I wanted to ask what the'cookiealert-dependencies.js' file is for.
The benefits are not yet quite clear to me :)

Regards
Andi

Make cookie alert remember close action

Thank you for sharing your work, much helpful! I was wondering if there's an easy way to configure the alert so that it remembers that a user has already accepted (closed) the alert. If I'm right currently the alert is triggered on each site load.

Remove background image

The background image present in the CSS can be removed, it just bloats up the CSS size and does not have any visible effect. The background color works just fine.

How to change background color ?

Hi, how can i change the background color from #212327 to #348899 ?? It's possible ???

I tried changing directly in the .css file, but it had no effect:
background: #348899 url('data:image/png;base64, ...)

An event that is fired if the user has already accepted cookies?

It seems window.dispatchEvent(new Event("cookieAlertAccept"))` only fires when the users clicks the accept. I feel it would be great to have this fire along with another event if not this one when the user loads the page. This would allow things like ads to turn on or other events to happen each page load after they have accepted.

I might try to hack this into my copy and submit it here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.