mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-09-19 14:49:29 +02:00
added extra cookie options as requested in #23
This commit is contained in:
26
README.md
26
README.md
@@ -88,6 +88,7 @@ One of the props (onAccept) is a function, this function will be called after th
|
||||
| onAccept | function | `() => {}` | Function to be called after the accept button has been clicked. |
|
||||
| debug | boolean | undefined | Bar will be drawn regardless of cookie for debugging purposes. |
|
||||
| expires | number | 365 | Number of days before the cookie expires. |
|
||||
| extraCookieOptions | object | `{}` | Extra info (apart from expiry date) to add to the cookie|
|
||||
| containerClasses| string | "" | CSS classes to apply to the surrounding container |
|
||||
| buttonClasses | string | "" | CSS classes to apply to the button |
|
||||
| contentClasses| string | "" | CSS classes to apply to the content |
|
||||
@@ -162,6 +163,31 @@ Which results in:
|
||||
|
||||

|
||||
|
||||
|
||||
#### Accept on scroll
|
||||
You can make the cookiebar disappear after scrolling a certain percentage using acceptOnScroll and acceptOnScrollPercentage.
|
||||
|
||||
```js
|
||||
<CookieConsent
|
||||
acceptOnScroll={true}
|
||||
acceptOnScrollPercentage={50}
|
||||
onAccept={() => {alert("consent given")}}
|
||||
>
|
||||
Hello scroller :)
|
||||
</CookieConsent>
|
||||
```
|
||||
|
||||
#### Extra cookie options
|
||||
You can add more cookie options using the extraCookieOptions parameter like so:
|
||||
|
||||
```js
|
||||
<CookieConsent
|
||||
extraCookieOptions={{domain: 'myexample.com'}}
|
||||
>
|
||||
cookie bar
|
||||
</CookieConsent>
|
||||
```
|
||||
|
||||
#### rainbows!
|
||||
|
||||

|
||||
|
Reference in New Issue
Block a user