zephir / kirby-cookieconsent

Cookieconsent plugin for Kirby 3
MIT License
43 stars 2 forks source link

Show modal again? #2

Closed squareclouds closed 11 months ago

squareclouds commented 1 year ago

hello and thank you for this great plugin! I am just wondering how do i call the modal again with a button or link.

i tried calling

cc.show()

via javascript after a click event but nothing happens.

EDIT: ah sorry, i didnt realise the delay and createModal parameters were mandatory... seems a bit strange but it works now

cc.show(delay?: number, createModal?: boolean)

TheMaaarc commented 1 year ago

Hi!

The options for show() are provided by the original cookieconsent js - they should be optional if I read their docs correctly, maybe there's something else going on. I'll change the code on my end to make the cc object available with an event that fires after everything is initialized, that should make everything work a bit better.

You can also use the "button" approach to show the modal: <button type="button" data-cc="c-settings">Manage cookie settings</button>

squareclouds commented 1 year ago

excellent :) thank you. yes i thought so too but somehow nothing was happening when i just called show() without options.

oh i didnt know about the button approach! thanks for that!

TheMaaarc commented 11 months ago

https://github.com/zephir/kirby-cookieconsent/releases/tag/2.0.0