How to add #hash clicking to an element
There's two ways, either you use javascript, where you have access to the window.location.hash, or you bind your click event to an <a href="#example">
, and prevent default on click, or think it's cool when your page goes up to the top, and the hash should appear in the browser adress bar.
Using plain old vanilla JS:
window.location.hash='example';
MDN on window.location
Reviving this thread, nowadays you can use history API
, works the same as above but also avoids automatically scroll to an id, giving you complete control of what you want to do with that hash:
window.history.pushState({}, "Example Title", "#example");
MDN on History API