Skip to content

Commit

Permalink
add "removable" option
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelwe committed Apr 18, 2024
1 parent d775b32 commit 1ab3f1a
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 26 deletions.
18 changes: 17 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,31 @@ <h1>DK-Badge javascript demo page</h1>
"privacy": "aucune donnée n'est collectée",
"emitted": "émis"
},
style: "full"
style: "full",
removable: true,
});
dkBadge.init();
document.addEventListener('dkBadge:removed', (data) => {
console.log('DKBadge removed', data);
});

// An example of how to reload the badge once it has been removed
// by the user if you want to provide this feature
function reloadBadge() {
localStorage.removeItem('dk-badge');
location.reload();
}
document.querySelector('[data-dk-badge-reload]').addEventListener('click', reloadBadge);
});
</script>


<div data-dk-badge></div>

<button data-dk-badge-reload>
Reload DK badge (if removed)
</button>

</header>
<nav role="navigation">
<ul>
Expand Down
2 changes: 1 addition & 1 deletion dist/css/dk-badge-all.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1ab3f1a

Please sign in to comment.