I have implemented my own UI for my story which has a number of panels around the main story panel. I now want one of those panels to be hidden when the game starts and appear later when a button is pressed to continue. So far I have this javascript:
You can’t make your own <a> link and put code inside it, that code just runs immediately as soon as the passage loads. Moreover the <<button>> doesn’t have either a destination or any content, so it doesn’t do anything either. Finally the <<run togglePanel>> is not correct Javascript syntax — to call a function you need to have a () at the end of the function name.
One final note. It’s generally considered to be a bad idea to define functions directly on window, as the chance of your function colliding with some other code is high. The usual Sugarcube advice is to define functions on the setup object instead. e.g. setup.togglePanel = function() { ... } which you would call with <<run setup.togglePanel()>>. You don’t have to do this, I often don’t, but it’s worth knowing that’s there’s a risk involved in not doing it.