I am looking for a way to change part of style by changing the hash. Let me explain by an example:
The current URL is:
example.com/drinks/?all-drinks=drinks
Then I click on the checkbox and the URL will change to :
example.com/drinks/?all-drinks=drinks&drinks=spirits-drinks
I want to change style
of a class.
I try the following code but it is not working:
<script>
$( window ).on( 'hashchange', function( e ) {
console.log( 'hash changed' );
} );
</script>
In fact, every time the hash changes nothing appears in the console.