I think it may be related to the href attribute of the a tag, that get interpreted as a next step in navigation (even if you go back in history).
Try removing the href attribute from the a.
As you see, this way it works:
Demo
You do need just to fix CSS for the a now